Skip to content

Commit

Permalink
fix(server): エラーのスタックトレースは返さないように
Browse files Browse the repository at this point in the history
Fix #10064
  • Loading branch information
syuilo committed Feb 26, 2023
1 parent cedfb85 commit cc149e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ You should also include the user name that made the change.
- fix(client): Android ChromeでPWAとしてインストールできない問題を修正
- 未知のユーザーが deleteActor されたら処理をスキップする
- fix(server): notes/createで、fileIdsと見つかったファイルの数が異なる場合はエラーにする
- fix(server): エラーのスタックトレースは返さないように

## 13.7.5 (2023/02/24)

Expand Down
7 changes: 5 additions & 2 deletions packages/backend/src/server/api/ApiCallService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { pipeline } from 'node:stream';
import * as fs from 'node:fs';
import { promisify } from 'node:util';
import { Inject, Injectable } from '@nestjs/common';
import { v4 as uuid } from 'uuid';
import { DI } from '@/di-symbols.js';
import { getIpHash } from '@/misc/get-ip-hash.js';
import type { LocalUser, User } from '@/models/entities/User.js';
Expand Down Expand Up @@ -320,21 +321,23 @@ export class ApiCallService implements OnApplicationShutdown {
if (err instanceof ApiError) {
throw err;
} else {
const errId = uuid();
this.logger.error(`Internal error occurred in ${ep.name}: ${err.message}`, {
ep: ep.name,
ps: data,
e: {
message: err.message,
code: err.name,
stack: err.stack,
id: errId,
},
});
console.error(err);
console.error(err, errId);
throw new ApiError(null, {
e: {
message: err.message,
code: err.name,
stack: err.stack,
id: errId,
},
});
}
Expand Down

0 comments on commit cc149e2

Please sign in to comment.