level-errors
Advanced tools
+21
| The MIT License (MIT) | ||
| Copyright © 2012 The contributors to level-errors. | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
+14
-2
| # Changelog | ||
| _**If you are upgrading:** please see [`UPGRADING.md`](UPGRADING.md)._ | ||
| ## [3.0.1] - 2021-09-24 | ||
| ### Fixed | ||
| - Don't wrap existing errors ([#37](https://github.com/Level/errors/issues/37)) ([`189f2b1`](https://github.com/Level/errors/commit/189f2b1)) (Vincent Weevers) | ||
| ## [3.0.0] - 2021-04-09 | ||
| _If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._ | ||
| ### Changed | ||
@@ -36,2 +42,4 @@ | ||
| _If you are upgrading: please see [`UPGRADING.md`](UPGRADING.md)._ | ||
| ### Changed | ||
@@ -113,6 +121,8 @@ | ||
| ## 1.0.1 - 2015-03-20 | ||
| ## [1.0.1] - 2015-03-20 | ||
| :seedling: Initial release. | ||
| [3.0.1]: https://github.com/Level/errors/compare/v3.0.0...v3.0.1 | ||
| [3.0.0]: https://github.com/Level/errors/compare/v2.0.1...v3.0.0 | ||
@@ -137,1 +147,3 @@ | ||
| [1.0.2]: https://github.com/Level/errors/compare/v1.0.1...v1.0.2 | ||
| [1.0.1]: https://github.com/Level/errors/releases/tag/v1.0.1 |
+37
-6
| 'use strict' | ||
| const createError = require('errno').create | ||
| const LevelUPError = createError('LevelUPError') | ||
| const NotFoundError = createError('NotFoundError', LevelUPError) | ||
| function createError (type, Proto) { | ||
| const Err = function (message, cause) { | ||
| if (typeof message === 'object' && message !== null) { | ||
| // Can be passed just a cause | ||
| cause = cause || message | ||
| message = message.message || message.name | ||
| } | ||
| NotFoundError.prototype.notFound = true | ||
| NotFoundError.prototype.status = 404 | ||
| message = message || '' | ||
| cause = cause || undefined | ||
| // If input is already of type, return as-is to keep its stack trace. | ||
| // Avoid instanceof, for when node_modules has multiple copies of level-errors. | ||
| if (typeof cause === 'object' && cause.type === type && cause.message === message) { | ||
| return cause | ||
| } | ||
| Object.defineProperty(this, 'type', { value: type, enumerable: false, writable: true, configurable: true }) | ||
| Object.defineProperty(this, 'name', { value: type, enumerable: false, writable: true, configurable: true }) | ||
| Object.defineProperty(this, 'cause', { value: cause, enumerable: false, writable: true, configurable: true }) | ||
| Object.defineProperty(this, 'message', { value: message, enumerable: false, writable: true, configurable: true }) | ||
| Error.call(this) | ||
| if (typeof Error.captureStackTrace === 'function') { | ||
| Error.captureStackTrace(this, Err) | ||
| } | ||
| } | ||
| Err.prototype = new Proto() | ||
| return Err | ||
| } | ||
| const LevelUPError = createError('LevelUPError', Error) | ||
| module.exports = { | ||
@@ -16,4 +44,7 @@ LevelUPError: LevelUPError, | ||
| WriteError: createError('WriteError', LevelUPError), | ||
| NotFoundError: NotFoundError, | ||
| NotFoundError: createError('NotFoundError', LevelUPError), | ||
| EncodingError: createError('EncodingError', LevelUPError) | ||
| } | ||
| module.exports.NotFoundError.prototype.notFound = true | ||
| module.exports.NotFoundError.prototype.status = 404 |
+2
-12
| { | ||
| "name": "level-errors", | ||
| "version": "3.0.0", | ||
| "version": "3.0.1", | ||
| "description": "Error types for levelup", | ||
@@ -10,3 +10,3 @@ "license": "MIT", | ||
| "test-browsers-local": "airtap --coverage test.js", | ||
| "coverage": "nyc report --reporter=text-lcov | coveralls", | ||
| "coverage": "nyc report -r lcovonly", | ||
| "hallmark": "hallmark --fix", | ||
@@ -19,16 +19,9 @@ "dependency-check": "dependency-check . test.js", | ||
| "CHANGELOG.md", | ||
| "CONTRIBUTORS.md", | ||
| "LICENSE.md", | ||
| "UPGRADING.md" | ||
| ], | ||
| "dependencies": { | ||
| "errno": "^1.0.0" | ||
| }, | ||
| "devDependencies": { | ||
| "airtap": "^4.0.3", | ||
| "airtap-playwright": "^1.0.1", | ||
| "coveralls": "^3.0.2", | ||
| "dependency-check": "^3.3.0", | ||
| "hallmark": "^3.1.0", | ||
| "level-community": "^3.0.0", | ||
| "nyc": "^15.1.0", | ||
@@ -38,5 +31,2 @@ "standard": "^16.0.3", | ||
| }, | ||
| "hallmark": { | ||
| "community": "level-community" | ||
| }, | ||
| "repository": { | ||
@@ -43,0 +33,0 @@ "type": "git", |
+8
-17
@@ -6,10 +6,9 @@ # level-errors | ||
| [![level badge][level-badge]](https://github.com/Level/awesome) | ||
| [](https://www.npmjs.com/package/level-errors) | ||
| [](https://www.npmjs.com/package/level-errors) | ||
| [](https://www.npmjs.com/package/level-errors) | ||
| [](https://travis-ci.com/Level/errors) | ||
| [](https://coveralls.io/github/Level/errors) | ||
| [](https://standardjs.com) | ||
| [](https://www.npmjs.com/package/level-errors) | ||
| [](#backers) | ||
| [](#sponsors) | ||
| [](https://github.com/Level/errors/actions/workflows/test.yml) | ||
| [](https://codecov.io/gh/Level/errors) | ||
| [](https://standardjs.com) | ||
| [](https://common-changelog.org) | ||
| [](https://opencollective.com/level) | ||
@@ -63,15 +62,7 @@ ## API | ||
| To sustain [`Level`](https://github.com/Level) and its activities, become a backer or sponsor on [Open Collective](https://opencollective.com/level). Your logo or avatar will be displayed on our 28+ [GitHub repositories](https://github.com/Level) and [npm](https://www.npmjs.com/) packages. 💖 | ||
| Support us with a monthly donation on [Open Collective](https://opencollective.com/level) and help us continue our work. | ||
| ### Backers | ||
| [](https://opencollective.com/level) | ||
| ### Sponsors | ||
| [](https://opencollective.com/level) | ||
| ## License | ||
| [MIT](LICENSE.md) © 2012-present [Contributors](CONTRIBUTORS.md). | ||
| [MIT](LICENSE) | ||
@@ -78,0 +69,0 @@ [level-badge]: https://leveljs.org/img/badge.svg |
| # Contributors | ||
| | Name | GitHub | Social | | ||
| | :------------------- | :----------------------------------------------------------- | :------------------------------------------------------------ | | ||
| | **Lars-Magnus Skog** | [**@ralphtheninja**](https://github.com/ralphtheninja) | [**@ralph@social.weho.st**](https://social.weho.st/@ralph) | | ||
| | **Vincent Weevers** | [**@vweevers**](https://github.com/vweevers) | [**@vweevers@twitter**](https://twitter.com/vweevers) | | ||
| | **Meirion Hughes** | [**@MeirionHughes**](https://github.com/MeirionHughes) | | | ||
| | **Julian Gruber** | [**@juliangruber**](https://github.com/juliangruber) | [**@juliangruber@twitter**](https://twitter.com/juliangruber) | |
-21
| # The MIT License (MIT) | ||
| **Copyright © 2012-present [Contributors](CONTRIBUTORS.md).** | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
0
-100%7
-22.22%39
160%13123
-1.25%6
-14.29%70
-11.39%- Removed
- Removed
- Removed