Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Added custom error for use with device actions #21

Merged
merged 2 commits into from
Sep 21, 2016

Conversation

kyork-cl
Copy link
Contributor

This is related to Zetta PR zettajs/zetta#322

@@ -34,6 +35,14 @@ var Device = module.exports = function Device() {

Device.DeviceConfig = DeviceConfig;

Device.ActionError = function(statusCode, properties) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the name is working probably. I think we need to set this.name = 'ActionError'; See test code:

var util = require('util');
var ActionError = function(statusCode, properties) {
  Error.captureStackTrace(this, this.constructor);
  this.name = this.constructor.name;
  this.statusCode = statusCode;
  this.properties = properties;
};
util.inherits(ActionError, Error);

var e = new ActionError(400, {});
console.log(e)
throw e;

{ [] name: '', statusCode: 400, properties: {} }

/Users/ApigeeCorporation/Software/apilife-ui/test.js:12
throw e;
^

    at Object.<anonymous> (/Users/ApigeeCorporation/Software/apilife-ui/test.js:10:9)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:134:18)
    at node.js:961:3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, didn't notice that. Fixed.

@AdamMagaluk AdamMagaluk merged commit e2dfc98 into zettajs:master Sep 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants