Skip to content

Commit dd51dd8

Browse files
committed
Improve DidKey error messages
1 parent 360e58d commit dd51dd8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/apicatalog/did/key/DidKey.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public static final DidKey from(final Did did, final MultibaseDecoder bases, fin
6464
throw new IllegalArgumentException("The given DID method [" + did.getMethod() + "] is not 'key'. DID [" + did.toString() + "].");
6565
}
6666

67-
final Multibase base = bases.getBase(did.getMethodSpecificId()).orElseThrow(() -> new IllegalArgumentException("Cannot detect did:key base encoding."));
67+
final Multibase base = bases.getBase(did.getMethodSpecificId()).orElseThrow(() -> new IllegalArgumentException("Unsupported did:key base encoding. DID [" + did.toString() + "]."));
6868

6969
final byte[] decoded = base.decode(did.getMethodSpecificId());
7070

71-
final Multicodec codec = codecs.getCodec(decoded).orElseThrow(() -> new IllegalArgumentException("Cannot detect did:key codec."));
71+
final Multicodec codec = codecs.getCodec(decoded).orElseThrow(() -> new IllegalArgumentException("Unsupported did:key codec. DID [" + did.toString() + "]."));
7272

7373
final byte[] rawKey = codec.decode(decoded);
7474

0 commit comments

Comments
 (0)