feat: unify InvokeError; add rawResponse to historical ErrorEvent
This commit is contained in:
@@ -25,14 +25,18 @@ export class InvokeError extends Error {
|
||||
type: InvokeErrorType
|
||||
retryable: boolean
|
||||
statusCode?: number
|
||||
/* raw error (provided if this error is caused by another error) */
|
||||
rawError?: unknown
|
||||
/* raw response from the API (provided if this error is caused by an API calling) */
|
||||
rawResponse?: unknown
|
||||
|
||||
constructor(type: InvokeErrorType, message: string, rawError?: unknown) {
|
||||
constructor(type: InvokeErrorType, message: string, rawError?: unknown, rawResponse?: unknown) {
|
||||
super(message)
|
||||
this.name = 'InvokeError'
|
||||
this.type = type
|
||||
this.retryable = this.isRetryable(type)
|
||||
this.rawError = rawError
|
||||
this.rawResponse = rawResponse
|
||||
}
|
||||
|
||||
private isRetryable(type: InvokeErrorType): boolean {
|
||||
|
||||
Reference in New Issue
Block a user