level-errors
Advanced tools
Comparing version 3.0.0 to 3.0.1
# 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 |
'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 |
{ | ||
"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", |
@@ -6,10 +6,9 @@ # level-errors | ||
[![level badge][level-badge]](https://github.com/Level/awesome) | ||
[![npm](https://img.shields.io/npm/v/level-errors.svg?label=&logo=npm)](https://www.npmjs.com/package/level-errors) | ||
[![npm](https://img.shields.io/npm/v/level-errors.svg)](https://www.npmjs.com/package/level-errors) | ||
[![Node version](https://img.shields.io/node/v/level-errors.svg)](https://www.npmjs.com/package/level-errors) | ||
[![Travis](https://img.shields.io/travis/com/Level/errors.svg?logo=travis&label=)](https://travis-ci.com/Level/errors) | ||
[![Coverage Status](https://coveralls.io/repos/github/Level/errors/badge.svg)](https://coveralls.io/github/Level/errors) | ||
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) | ||
[![npm](https://img.shields.io/npm/dm/level-errors.svg?label=dl)](https://www.npmjs.com/package/level-errors) | ||
[![Backers on Open Collective](https://opencollective.com/level/backers/badge.svg?color=orange)](#backers) | ||
[![Sponsors on Open Collective](https://opencollective.com/level/sponsors/badge.svg?color=orange)](#sponsors) | ||
[![Test](https://img.shields.io/github/workflow/status/Level/errors/Test?label=test)](https://github.com/Level/errors/actions/workflows/test.yml) | ||
[![Coverage](https://img.shields.io/codecov/c/github/Level/errors?label=&logo=codecov&logoColor=fff)](https://codecov.io/gh/Level/errors) | ||
[![Standard](https://img.shields.io/badge/standard-informational?logo=javascript&logoColor=fff)](https://standardjs.com) | ||
[![Common Changelog](https://common-changelog.org/badge.svg)](https://common-changelog.org) | ||
[![Donate](https://img.shields.io/badge/donate-orange?logo=open-collective&logoColor=fff)](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 | ||
[![Open Collective backers](https://opencollective.com/level/backers.svg?width=890)](https://opencollective.com/level) | ||
### Sponsors | ||
[![Open Collective sponsors](https://opencollective.com/level/sponsors.svg?width=890)](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 |
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
0
7
39
13123
6
70
- Removederrno@^1.0.0
- Removederrno@1.0.0(transitive)
- Removedprr@1.0.1(transitive)