mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
feat(core): guard service (#9816)
This commit is contained in:
@@ -19,11 +19,18 @@ export class UserFriendlyError
|
||||
readonly status = this.response.status;
|
||||
readonly code = this.response.code;
|
||||
readonly type = this.response.type;
|
||||
override readonly name = this.response.name;
|
||||
readonly rawName = this.response.name;
|
||||
override readonly message = this.response.message;
|
||||
readonly data = this.response.data;
|
||||
readonly stacktrace = this.response.stacktrace;
|
||||
|
||||
override get name() {
|
||||
if (this.rawName in ErrorNames) {
|
||||
return this.rawName;
|
||||
}
|
||||
return ErrorNames.INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
static fromAnyError(response: any) {
|
||||
if (response instanceof GraphQLError) {
|
||||
return new UserFriendlyError(response.extensions);
|
||||
|
||||
Reference in New Issue
Block a user