httpexceptions
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -13,36 +13,19 @@ var HTTPException = (function () { | ||
} | ||
this.message = message; | ||
this.status = status; | ||
this.message = message || ''; | ||
if (innerException) { | ||
if (innerException instanceof Error) { | ||
this.innerException = innerException; | ||
this.message = this.getMessages() + ", innerException: " + this.innerException.message; | ||
this.message = this.message + ", innerException: " + this.innerException.message; | ||
} | ||
else if (typeof innerException === "string") { | ||
this.innerException = new Error(innerException); | ||
this.message = this.getMessages() + ", innerException: " + this.innerException.message; | ||
this.message = this.message + ", innerException: " + this.innerException.message; | ||
} | ||
else { | ||
this.innerException = innerException; | ||
this.message = this.getMessages() + ", innerException: " + this.innerException; | ||
this.message = this.message + ", innerException: " + this.innerException; | ||
} | ||
} | ||
else { | ||
this.message = message; | ||
} | ||
} | ||
/** | ||
* | ||
* @returns {number} | ||
*/ | ||
HTTPException.prototype.getStatus = function () { | ||
return this.status; | ||
}; | ||
/** | ||
* | ||
* @returns {string} | ||
*/ | ||
HTTPException.prototype.getMessages = function () { | ||
return this.type.replace(/_/gi, ' ') + (this.message ? ' - ' + this.message : ''); | ||
}; | ||
return HTTPException; | ||
@@ -49,0 +32,0 @@ })(); |
@@ -28,4 +28,4 @@ declare class Error { | ||
this.message = message; | ||
this.status = status; | ||
this.message = message || ''; | ||
@@ -35,35 +35,17 @@ if (innerException) { | ||
this.innerException = innerException; | ||
this.message = this.getMessages() + ", innerException: " + this.innerException.message; | ||
this.message = this.message + ", innerException: " + this.innerException.message; | ||
} | ||
else if (typeof innerException === "string") { | ||
this.innerException = new Error(innerException); | ||
this.message = this.getMessages() + ", innerException: " + this.innerException.message; | ||
this.message = this.message + ", innerException: " + this.innerException.message; | ||
} | ||
else { | ||
this.innerException = innerException; | ||
this.message = this.getMessages() + ", innerException: " + this.innerException; | ||
this.message = this.message + ", innerException: " + this.innerException; | ||
} | ||
} | ||
else { | ||
this.message = message; | ||
} | ||
} | ||
/** | ||
* | ||
* @returns {number} | ||
*/ | ||
getStatus():number{ | ||
return this.status; | ||
} | ||
/** | ||
* | ||
* @returns {string} | ||
*/ | ||
getMessages(): string{ | ||
return this.type.replace(/_/gi, ' ') + (this.message ? ' - ' + this.message : ''); | ||
} | ||
} | ||
export = HTTPException; |
{ | ||
"name": "httpexceptions", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Provide exception for HTTP Rest API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
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
171542
3768