utils: changeErrorType also copy params

This commit is contained in:
undefined committed 2021-07-30 17:00:28 +08:00
1 parent 2a4169d02b
commit 0476e6a4b1
3 files changed
+5 -3

No files matched your search

+2 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@hydrooj/hydrojudge", "name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js", "bin": "bin/hydrojudge.js",
"version": "2.9.0", "version": "2.9.1",
"main": "package.json", "main": "package.json",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git", "repository": "https://github.com/hydro-dev/Hydro.git",
@@ -9,6 +9,7 @@
"@hydrooj/utils": "^1.0.14", "@hydrooj/utils": "^1.0.14",
"axios": "^0.21.1", "axios": "^0.21.1",
"cac": "^6.7.3", "cac": "^6.7.3",
"esbuild": "^0.12.17",
"fs-extra": "^10.0.0", "fs-extra": "^10.0.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
+2 -1
View File
@@ -311,9 +311,10 @@ export function formatSeconds(_seconds = '0') {
); );
} }
export function changeErrorType(err: Error, Err: any) { export function changeErrorType(err: any, Err: any) {
const e = new Err(err.message); const e = new Err(err.message);
e.stack = err.stack; e.stack = err.stack;
if (err.params) e.params = err.params;
return e; return e;
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/utils", "name": "@hydrooj/utils",
"version": "1.1.0", "version": "1.1.1",
"description": "hydrooj utils", "description": "hydrooj utils",
"main": "package.json", "main": "package.json",
"repository": "https://github.com/hydro-dev/Hydro.git", "repository": "https://github.com/hydro-dev/Hydro.git",