Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 1x 1x 13x 13x 13x 13x | import { SdkError, commonErrors } from '@affinidi/tools-common'
export default class SdkErrorFromCode extends SdkError {
constructor(code: string, context: unknown = {}, originalError: unknown = {}) {
const error = SdkErrorFromCode.errors[code]
Iif (!error) {
throw new Error(`Invalid operation error code: ${code}`)
}
super({ ...error, code }, context, originalError)
}
static get errors(): any {
return {
...commonErrors,
// NOTE: errors related to SDK only should be added here with a separate prefix SDK-XXX (SDK-1), not to commonErrors
}
}
}
|