feat: Removing stack trace info in production env (#11657)

* feat: Hiding stack traces in production env

* sytle

* style

* style

* add SPDX

* move ./error.js to ./misc/error.js

* revert: remove frontend changes

* feat: Hiding stack traces in production env

* feat: Hiding stack traces in production env

* revert

* revert

* revert

* change and fix

* revert

* fix queue endpoint test

---------

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
Co-authored-by: Kagami Sascha Rosylight <saschanaz@outlook.com>
This commit is contained in:
MomentQYC 2023-08-21 16:21:57 +08:00 committed by GitHub
parent 50ec129b87
commit 388448f298
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 7 deletions

View file

@ -148,18 +148,18 @@ export class ClientServerService {
if (url === bullBoardPath || url.startsWith(bullBoardPath + '/')) {
const token = request.cookies.token;
if (token == null) {
reply.code(401);
throw new Error('login required');
reply.code(401).send('Login required');
return;
}
const user = await this.usersRepository.findOneBy({ token });
if (user == null) {
reply.code(403);
throw new Error('no such user');
reply.code(403).send('No such user');
return;
}
const isAdministrator = await this.roleService.isAdministrator(user);
if (!isAdministrator) {
reply.code(403);
throw new Error('access denied');
reply.code(403).send('Access denied');
return;
}
}
});