node-exceptions
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -0,1 +1,7 @@ | ||
<a name="1.0.1"></a> | ||
## [1.0.1](https://github.com/poppinss/node-exceptions/compare/v1.0.0...v1.0.1) (2016-02-05) | ||
<a name="1.0.0"></a> | ||
@@ -8,5 +14,2 @@ # 1.0.0 (2016-02-04) | ||
* Initial commit ([24ff232](https://github.com/poppinss/node-exceptions/commit/24ff232)) | ||
* **travis:** added travis.yml file ([51aa3e6](https://github.com/poppinss/node-exceptions/commit/51aa3e6)) | ||
* **travis:** added travis.yml file ([51aa3e6](https://github.com/poppinss/node-exceptions/commit/51aa3e6)) |
{ | ||
"name": "node-exceptions", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "personalized and extendable exception class for nodejs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -41,3 +41,3 @@ Node Exceptions | ||
} catch (e) { | ||
console.log(e.code) // equals 500 | ||
console.log(e.status) // equals 500 | ||
console.log(e.name) // equals MyCustomError | ||
@@ -50,4 +50,4 @@ console.log(e.message) // Something bad happened | ||
## Custom error code | ||
It is also possible to have a custom error code when throwing exceptions. | ||
## Custom error status | ||
It is also possible to have a custom error status when throwing exceptions. | ||
@@ -62,3 +62,3 @@ ```javascript | ||
} catch (e) { | ||
console.log(e.code) // equals 404 | ||
console.log(e.status) // equals 404 | ||
} | ||
@@ -65,0 +65,0 @@ ``` |
@@ -12,9 +12,9 @@ 'use strict' | ||
module.exports = function LogicalException (message, code) { | ||
module.exports = function LogicalException (message, status) { | ||
Error.captureStackTrace(this, this.constructor) | ||
this.name = this.constructor.name | ||
this.message = message | ||
this.code = code || 500 | ||
this.status = status || 500 | ||
} | ||
require('util').inherits(module.exports, Error) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6804