enhance(frontend): エラー発生時のダイアログに詳細情報を載せる (MisskeyIO#543)

This commit is contained in:
まっちゃとーにゅ 2024-03-20 15:42:20 +09:00 committed by GitHub
parent 41ea486881
commit daf297c9c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 37 additions and 26 deletions

View file

@ -389,11 +389,9 @@ export class ApiCallService implements OnApplicationShutdown {
id: err.id,
},
{
e: {
message: err.message,
code: err.name,
id: err.id,
},
message: err.message,
code: err.name,
id: err.id,
},
);
} else {
@ -416,11 +414,9 @@ export class ApiCallService implements OnApplicationShutdown {
kind: 'server',
},
{
e: {
message: err.message,
code: err.name,
id: errId,
},
message: err.message,
code: err.name,
id: errId,
},
);
}

View file

@ -63,7 +63,7 @@ export abstract class Endpoint<T extends IEndpointMeta, Ps extends Schema> {
id: '3d81ceae-475f-4600-b2a8-2bc116157532',
}, {
param: errors[0].schemaPath,
reason: errors[0].message,
reason: errors[0].message ?? 'Invalid',
});
return Promise.reject(err);
}

View file

@ -85,11 +85,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
id: '5c77c4d7-0f68-48f9-8694-8453a2294840',
},
{
e: {
message: err.message,
code: err.name,
}
}
message: err.message,
code: err.name,
},
);
}

View file

@ -191,10 +191,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
id: '6708863c-6791-4487-aa01-2d682c6e7db0',
},
{
e: {
message: err.message,
code: err.name,
},
message: err.message,
code: err.name,
},
);
} finally {

View file

@ -11,15 +11,15 @@ export class ApiError extends Error {
public id: string;
public kind: string;
public httpStatusCode?: number;
public info?: any;
public info?: Record<string, string>;
constructor(err: E, info?: any | null | undefined) {
constructor(err: E, info?: Record<string, string> | null | undefined) {
super(err.message);
this.message = err.message;
this.code = err.code;
this.id = err.id;
this.kind = err.kind ?? 'client';
this.httpStatusCode = err.httpStatusCode;
this.info = info;
this.info = info ?? undefined;
}
}