From 7d962bc3ade8cb363c1f982266b77dfc28876b2f Mon Sep 17 00:00:00 2001 From: colder Date: Sun, 1 Apr 2018 13:35:57 +0800 Subject: [PATCH] fix: log sent error --- microless/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/microless/index.ts b/microless/index.ts index d62a88f..42aa0c9 100644 --- a/microless/index.ts +++ b/microless/index.ts @@ -108,12 +108,14 @@ export const sendError = (req: Request, res: Response, err: httpError.HttpError) res.end({ error: err }) } - if (!DEV) return - if (err instanceof Error) { - console.error(err.stack) + if (DEV) { + console.error(err.stack) + } else { + console.error(err.message) + } } else { - console.warn('thrown error must be an instance Error') + console.warn('thrown error should be an Error but got', err) } }