mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +09:00
Don't log print permission denied stack traces
Use PermissionError to signal when permission is denied for an action and prevent them being logged as stack traces in the master log.
This commit is contained in:
1 parent
7ecac539f9
commit
bfea6cb28e
2 files changed
+17
-2
No files matched your search
@@ -9,6 +9,9 @@
|
||||
"use strict";
|
||||
const jwt = require("jsonwebtoken");
|
||||
|
||||
const libErrors = require("./errors");
|
||||
|
||||
|
||||
/**
|
||||
* Represents a permission that can be granted
|
||||
* @static
|
||||
@@ -254,7 +257,8 @@ class User {
|
||||
* "Permission denied" error is thrown.
|
||||
*
|
||||
* @param {string} permission - The permission to check for.
|
||||
* @throws {Error} if the user does noh have the given permission.
|
||||
* @throws {Error} If the given permission does not exist.
|
||||
* @throws {module:lib/errors.PermissionError} if the user does noh have the given permission.
|
||||
*/
|
||||
checkPermission(permission) {
|
||||
if (!permissions.has(permission)) {
|
||||
@@ -267,7 +271,7 @@ class User {
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error("Permission denied");
|
||||
throw new libErrors.PermissionError("Permission denied");
|
||||
}
|
||||
|
||||
notifyJoin(instance_id) {
|
||||
|
||||
Reference in new issue
Block a user