@qingfu/core-env 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/broker.js CHANGED
@@ -38,10 +38,7 @@ if ( process.env.BROKER_URI ) {
38
38
  nonce: ctx.meta.nonce,
39
39
  timestamp: ctx.meta.timestamp
40
40
  });
41
- if ( !nonce ) throw Object.assign(
42
- new MoleculerError( 'NONCE_CONFLICT', 409 ),
43
- { expose: true }
44
- );
41
+ if ( !nonce ) throw new MoleculerError( 'NONCE_CONFLICT', 409, 'NONCE_CONFLICT', { expose: true });
45
42
  }
46
43
  return await next( ctx );
47
44
  };
package/lib/server.js CHANGED
@@ -42,7 +42,7 @@ if ( process.env.HTTP_PORT ) {
42
42
  err.code && err.name !== 'MongoServerError' && +err.code ||
43
43
  err.status && err.status ||
44
44
  err.message && +err.message || 500;
45
- ctx.message = err.expose && !+err.message && err.message || ctx.message;
45
+ ctx.message = _.get( err, 'data.expose', err.expose ) && !+err.message && err.message || ctx.message;
46
46
  ctx.app.emit( 'error', err, ctx );
47
47
  let accepts = ctx.accepts( 'json', 'html', 'text' );
48
48
  let data = { status: ctx.status, message: ctx.message, ...( err.body || {} )};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qingfu/core-env",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "readmeFilename": "README.md",
5
5
  "dependencies": {
6
6
  "@koa/cors": "5.0.0",