Skip to content

Conversation

@teogeb
Copy link
Contributor

@teogeb teogeb commented Nov 21, 2024

Removed custom DecryptError class. Using StreamrClientError with code DECRYPT_ERROR instead.

Changed some wording of decrypt errors: encryption keys are no longer referred as group key, which is an internal term for encryption key (see e.g. exports.ts#36).

Cause parameter

Considered adding cause parameter for StreamrClientError (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause). Decided not to include it as it we've earlier had compatibility issues with it when using Firefox. Maybe browser support is nowadays better. We can add that later if needed.

The cause parameter would link root cause Error instances to StreamrClientError and therefore provide very detailed stack traces. For client errors such stack traces are maybe not needed in practice. I.e. if decryptWithAES() throws an error, we'll create a StreamrClientError with message of "AES decryption failed" and type of DECRYPT_ERROR. In most cases these bits of information are sufficient for analyzing application level issues.

Future improvements

  • convert all other custom errors to StreamrClientError
  • add toEqualStreamrError() test utility

@github-actions github-actions bot added the sdk label Nov 21, 2024
@teogeb teogeb requested a review from harbu November 21, 2024 12:46
teogeb added a commit that referenced this pull request Nov 22, 2024
Based on #2896, merge that
first.

Added new custom matcher. Will be used e.g. in
#2895.
@teogeb teogeb merged commit 9d2c0f5 into main Nov 26, 2024
23 checks passed
@teogeb teogeb deleted the decrypt-error-is-StreamrClientError branch November 26, 2024 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants