Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Hinek <[email protected]>
  • Loading branch information
frankhinek committed Feb 27, 2024
1 parent b4fa4ec commit 0aa36d1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/crypto/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export function getJoseSignatureAlgorithmFromPublicKey(publicKey: Jwk): string {
return curveToJoseAlgorithm[publicKey.crv];
}

throw new Error(`Unable to determine algorithm based on provided input: alg=${publicKey.alg}, crv=${publicKey.crv}`);
throw new Error(
`Unable to determine algorithm based on provided input: alg=${publicKey.alg}, crv=${publicKey.crv}. ` +
`Supported 'alg' values: ${Object.values(curveToJoseAlgorithm).join(', ')}. ` +
`Supported 'crv' values: ${Object.keys(curveToJoseAlgorithm).join(', ')}.`
);
}

/**
Expand Down

0 comments on commit 0aa36d1

Please sign in to comment.