enhance(logging): エラー時もっと詳しい情報が残るように (MisskeyIO#360)

This commit is contained in:
まっちゃとーにゅ 2024-01-16 02:29:53 +09:00 committed by GitHub
parent bad14005f8
commit 411a8bd8e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 11 deletions

View file

@ -77,8 +77,20 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Create file
driveFile = await this.driveService.uploadFromUrl({ url: emoji.originalUrl, user: null, force: true });
} catch (e) {
// TODO: need to return Drive Error
throw new ApiError();
const err = e as Error;
throw new ApiError(
{
message: 'Failed to upload image from URL.',
code: 'FAILED_TO_UPLOAD_IMAGE_FROM_URL',
id: '5c77c4d7-0f68-48f9-8694-8453a2294840',
},
{
e: {
message: err.message,
code: err.name,
}
}
);
}
// Duplication Check