mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
@@ -12,14 +12,17 @@ export interface UserFriendlyErrorResponse {
|
||||
stacktrace?: string;
|
||||
}
|
||||
|
||||
export class UserFriendlyError implements UserFriendlyErrorResponse {
|
||||
status = this.response.status;
|
||||
code = this.response.code;
|
||||
type = this.response.type;
|
||||
name = this.response.name;
|
||||
message = this.response.message;
|
||||
args = this.response.args;
|
||||
stacktrace = this.response.stacktrace;
|
||||
export class UserFriendlyError
|
||||
extends Error
|
||||
implements UserFriendlyErrorResponse
|
||||
{
|
||||
readonly status = this.response.status;
|
||||
readonly code = this.response.code;
|
||||
readonly type = this.response.type;
|
||||
override readonly name = this.response.name;
|
||||
override readonly message = this.response.message;
|
||||
readonly args = this.response.args;
|
||||
readonly stacktrace = this.response.stacktrace;
|
||||
|
||||
static fromAnyError(response: any) {
|
||||
if (response instanceof GraphQLError) {
|
||||
@@ -51,7 +54,9 @@ export class UserFriendlyError implements UserFriendlyErrorResponse {
|
||||
});
|
||||
}
|
||||
|
||||
constructor(private readonly response: UserFriendlyErrorResponse) {}
|
||||
constructor(private readonly response: UserFriendlyErrorResponse) {
|
||||
super(response.message);
|
||||
}
|
||||
}
|
||||
|
||||
export class GraphQLError extends BaseGraphQLError {
|
||||
|
||||
Reference in New Issue
Block a user