fix: prod check
This commit is contained in:
parent
eb3245319d
commit
f6315932eb
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user