feat(repos): 获取 commit logs 时,允许返回错误信息给调用方。

This commit is contained in:
Ivan Li
2021-06-27 10:33:32 +08:00
parent 9d735c582c
commit 7e17de0f15
3 changed files with 22 additions and 12 deletions

View File

@ -1,11 +1,11 @@
import { pick } from 'ramda';
export class ApplicationException extends Error {
code: number;
error: Error;
constructor(
message:
| string
| { error?: Error; message?: string | object; code?: number },
message: string | { error?: Error; message?: string | any; code?: number },
) {
if (message instanceof Object) {
super();
@ -18,4 +18,8 @@ export class ApplicationException extends Error {
super((message as unknown) as any);
}
}
toJSON() {
return pick(['code', 'message'], this);
}
}