Error handling
The application throws nested errors, ranging from functional to technical.
Example of an invalid KAS credential error during decryption:
bash
[SdsdkError: ZTDF encryption failed] {
cause: FetchingError: fetching error
at wo.queryWithApiKeyCredentials (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:35492)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async ic.encryptDek (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:87058)
... 5 lines matching cause stack trace ...
at async $c.encrypt (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:109031)
at async <anonymous> (/home/***/src/encrypt.ts:6:18) {
cause: HttpError: HTTP Error 401: Unauthorized - {"code":401,"message":"Kas Encrypt route call failed. Please contact your administrator.","details":"2001026,2006003,1014001,2005006"}
at wo.sendRequest (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:36782)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async wo.queryWithApiKeyCredentials (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:35428)
at async ic.encryptDek (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:87058)
at async sc.wrapSym (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:88503)
at async sc.wrapWithSingleKas (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:88266)
at async Promise.all (index 0)
at async sc.wrap (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:87612)
at async Pc.execute (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:108045)
at async $c.encrypt (file:///home/***/node_modules/sdsdk/dist/sdsdk.mjs:14:109031) {
status: 401,
statusText: 'Unauthorized',
body: '{"code":401,"message":"Kas Encrypt route call failed. Please contact your administrator.","details":"2001026,2006003,1014001,2005006"}'
}
}
}All errors thrown by the Stormshield SDK are SdsdkError. These errors may have causes that add context to the generic SdsdkError. The Stormshield SDK exposes the following errors:
| Error class name | Description |
|---|---|
| SdsdkError | Generic error thrown by methods of the Sdsdk class |
| SdsdkValidationError | Validation error |
| UnexpectedError | An unexpected error occurred in the Stormshield SDK |
| UnsupportedAlgorithm | The algorithm is not supported by the Stormshield SDK |
| FetchingError | Error occurred while fetching data |
| CryptographyError | Error occurred during cryptographic operations |
| JwsSignerError | Error occurred while signing a JWS message |
| JwsVerifyError | Error occurred while verifying a JWS message |
| CanonicalizerError | Error occurred during canonicalization process |
| InvalidAssertionIntegrityError | Assertion integrity check failed |
| UnwrapDekError | Error occurred while unwrapping DEK |
| InvalidBase64Error | Invalid Base64 encoding detected |
| NetworkError | Network communication error occurred |
| ParsingError | Error occurred while parsing data |
| InvalidFetcher | Invalid fetcher configuration or implementation |
| EncryptionError | Error occurred during encryption process |
| DecryptionError | Error occurred during decryption process |
| KeyPairGenerationError | Error occurred while generating a key pair |
| SigningError | Error occurred while signing data |
| SignatureVerificationError | Error occurred while verifying a signature |
| KeyImportError | Error occurred while importing a key |
| RandomGenerationError | Error occurred while generating random data |
| UuidGenerationError | Error occurred while generating a UUID |
| HashingError | Error occurred during hashing process |