fix: prod check

This commit is contained in:
cha0s 2021-01-18 12:33:18 -06:00
parent eb3245319d
commit f6315932eb

View File

@ -14,11 +14,15 @@ export default (socket) => async (packet, fn) => {
return;
}
debug('acceptor error: %O', error);
const isProduction = 'client' === process.env.SIDE
? process.env.NODE_ENV
// eslint-disable-next-line no-eval
: eval('process.env.NODE_ENV');
if (error instanceof Error) {
fn({
code: error.code || 500,
reason: 'production' === process.env.NODE_ENV ? 'error' : error.message,
...('production' === process.env.NODE_ENV ? {} : {stack: error.stack}),
reason: 'production' === isProduction ? 'error' : error.message,
...('production' === isProduction ? {} : {stack: error.stack}),
});
return;
}