@loves/loves-web-error-handler
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -77,4 +77,10 @@ const webErrorHandler = { | ||
}, | ||
unavailableError(message = 'The service is currently unavailable.') { | ||
return { | ||
message, | ||
statusCode: 503, | ||
}; | ||
}, | ||
}; | ||
module.exports = webErrorHandler; |
{ | ||
"name": "@loves/loves-web-error-handler", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A web error handler that formats responses.", | ||
@@ -16,2 +16,3 @@ "main": "app.js", | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"eslint": "^3.19.0", | ||
@@ -31,5 +32,3 @@ "eslint-config-airbnb": "^14.1.0", | ||
"homepage": "https://github.com/LovesTravelStops/loves-web-error-handler#readme", | ||
"dependencies": { | ||
"chai": "^4.1.2" | ||
} | ||
"dependencies": {} | ||
} |
@@ -61,3 +61,2 @@ const chai = require('chai'); | ||
}); | ||
it('should create 404 error correctly', () => { | ||
@@ -128,2 +127,19 @@ const expected = { | ||
}); | ||
it('should create service unavailable error correctly', () => { | ||
const expected = { | ||
message: 'The service is currently unavailable.', | ||
statusCode: 503, | ||
}; | ||
const actual = testableApp.unavailableError(); | ||
expect(actual).to.deep.equal(expected); | ||
}); | ||
it('should create service unavailable error with specific message correctly', () => { | ||
const errorString = 'This service is under maintenance until 12 pm CST.'; | ||
const expected = { | ||
message: errorString, | ||
statusCode: 503, | ||
}; | ||
const actual = testableApp.unavailableError(errorString); | ||
expect(actual).to.deep.equal(expected); | ||
}); | ||
it('should add validation errors correctly', () => { | ||
@@ -130,0 +146,0 @@ const message = 'Form validation failed.'; |
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
81849
0
269
8
- Removedchai@^4.1.2
- Removedassertion-error@1.1.0(transitive)
- Removedchai@4.5.0(transitive)
- Removedcheck-error@1.0.3(transitive)
- Removeddeep-eql@4.1.4(transitive)
- Removedget-func-name@2.0.2(transitive)
- Removedloupe@2.3.7(transitive)
- Removedpathval@1.1.1(transitive)
- Removedtype-detect@4.1.0(transitive)