Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@betterer/errors

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@betterer/errors - npm Package Compare versions

Comparing version 3.1.1 to 4.0.0

42

CHANGELOG.md

@@ -6,2 +6,44 @@ # Change Log

# [4.0.0](https://github.com/phenomnomnominal/betterer/compare/v3.1.2...v4.0.0) (2021-02-27)
### Bug Fixes
* **docs 📚:** restore header image ([#544](https://github.com/phenomnomnominal/betterer/issues/544)) ([e30a941](https://github.com/phenomnomnominal/betterer/commit/e30a941cc8badd79c4eaf505449ed56fda1be1bf))
### Code Refactoring
* **betterer 🔧:** rewrite pretty much everything v4.0.0 ([#543](https://github.com/phenomnomnominal/betterer/issues/543)) ([48b85bd](https://github.com/phenomnomnominal/betterer/commit/48b85bd9482cb42673556917508ac741ab970587)), closes [#223](https://github.com/phenomnomnominal/betterer/issues/223) [#227](https://github.com/phenomnomnominal/betterer/issues/227) [#233](https://github.com/phenomnomnominal/betterer/issues/233) [#234](https://github.com/phenomnomnominal/betterer/issues/234) [#235](https://github.com/phenomnomnominal/betterer/issues/235) [#236](https://github.com/phenomnomnominal/betterer/issues/236) [#237](https://github.com/phenomnomnominal/betterer/issues/237) [#226](https://github.com/phenomnomnominal/betterer/issues/226) [#238](https://github.com/phenomnomnominal/betterer/issues/238) [#239](https://github.com/phenomnomnominal/betterer/issues/239) [#240](https://github.com/phenomnomnominal/betterer/issues/240) [#243](https://github.com/phenomnomnominal/betterer/issues/243) [#248](https://github.com/phenomnomnominal/betterer/issues/248) [#250](https://github.com/phenomnomnominal/betterer/issues/250) [#251](https://github.com/phenomnomnominal/betterer/issues/251) [#254](https://github.com/phenomnomnominal/betterer/issues/254) [#255](https://github.com/phenomnomnominal/betterer/issues/255) [#257](https://github.com/phenomnomnominal/betterer/issues/257) [#267](https://github.com/phenomnomnominal/betterer/issues/267) [#268](https://github.com/phenomnomnominal/betterer/issues/268) [#271](https://github.com/phenomnomnominal/betterer/issues/271) [#272](https://github.com/phenomnomnominal/betterer/issues/272) [#273](https://github.com/phenomnomnominal/betterer/issues/273) [#276](https://github.com/phenomnomnominal/betterer/issues/276) [#310](https://github.com/phenomnomnominal/betterer/issues/310) [#314](https://github.com/phenomnomnominal/betterer/issues/314) [#315](https://github.com/phenomnomnominal/betterer/issues/315) [#316](https://github.com/phenomnomnominal/betterer/issues/316) [#317](https://github.com/phenomnomnominal/betterer/issues/317) [#320](https://github.com/phenomnomnominal/betterer/issues/320) [#321](https://github.com/phenomnomnominal/betterer/issues/321) [#322](https://github.com/phenomnomnominal/betterer/issues/322) [#327](https://github.com/phenomnomnominal/betterer/issues/327) [#328](https://github.com/phenomnomnominal/betterer/issues/328) [#330](https://github.com/phenomnomnominal/betterer/issues/330) [#331](https://github.com/phenomnomnominal/betterer/issues/331) [#336](https://github.com/phenomnomnominal/betterer/issues/336) [#338](https://github.com/phenomnomnominal/betterer/issues/338) [#350](https://github.com/phenomnomnominal/betterer/issues/350) [#339](https://github.com/phenomnomnominal/betterer/issues/339) [#367](https://github.com/phenomnomnominal/betterer/issues/367) [#370](https://github.com/phenomnomnominal/betterer/issues/370) [#399](https://github.com/phenomnomnominal/betterer/issues/399) [#400](https://github.com/phenomnomnominal/betterer/issues/400) [#401](https://github.com/phenomnomnominal/betterer/issues/401) [#402](https://github.com/phenomnomnominal/betterer/issues/402) [#403](https://github.com/phenomnomnominal/betterer/issues/403) [#404](https://github.com/phenomnomnominal/betterer/issues/404) [#410](https://github.com/phenomnomnominal/betterer/issues/410) [#411](https://github.com/phenomnomnominal/betterer/issues/411) [#412](https://github.com/phenomnomnominal/betterer/issues/412) [#414](https://github.com/phenomnomnominal/betterer/issues/414) [#453](https://github.com/phenomnomnominal/betterer/issues/453) [#454](https://github.com/phenomnomnominal/betterer/issues/454) [#455](https://github.com/phenomnomnominal/betterer/issues/455) [#456](https://github.com/phenomnomnominal/betterer/issues/456) [#467](https://github.com/phenomnomnominal/betterer/issues/467) [#468](https://github.com/phenomnomnominal/betterer/issues/468) [#457](https://github.com/phenomnomnominal/betterer/issues/457) [#482](https://github.com/phenomnomnominal/betterer/issues/482) [#483](https://github.com/phenomnomnominal/betterer/issues/483) [#485](https://github.com/phenomnomnominal/betterer/issues/485) [#486](https://github.com/phenomnomnominal/betterer/issues/486) [#489](https://github.com/phenomnomnominal/betterer/issues/489) [#490](https://github.com/phenomnomnominal/betterer/issues/490) [#492](https://github.com/phenomnomnominal/betterer/issues/492) [#493](https://github.com/phenomnomnominal/betterer/issues/493) [#494](https://github.com/phenomnomnominal/betterer/issues/494) [#495](https://github.com/phenomnomnominal/betterer/issues/495) [#496](https://github.com/phenomnomnominal/betterer/issues/496) [#498](https://github.com/phenomnomnominal/betterer/issues/498) [#502](https://github.com/phenomnomnominal/betterer/issues/502) [#503](https://github.com/phenomnomnominal/betterer/issues/503) [#504](https://github.com/phenomnomnominal/betterer/issues/504) [#505](https://github.com/phenomnomnominal/betterer/issues/505) [#520](https://github.com/phenomnomnominal/betterer/issues/520) [#526](https://github.com/phenomnomnominal/betterer/issues/526) [#530](https://github.com/phenomnomnominal/betterer/issues/530) [#533](https://github.com/phenomnomnominal/betterer/issues/533) [#539](https://github.com/phenomnomnominal/betterer/issues/539) [#540](https://github.com/phenomnomnominal/betterer/issues/540) [#542](https://github.com/phenomnomnominal/betterer/issues/542) [#541](https://github.com/phenomnomnominal/betterer/issues/541)
### BREAKING CHANGES
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
* chore(betterer 🕸): remove check for completed eslint rules
* **betterer 🔧:** Changes to the public API
* **betterer 🔧:** Changes to the public API
## [3.1.1](https://github.com/phenomnomnominal/betterer/compare/v3.1.0...v3.1.1) (2020-10-29)

@@ -8,0 +50,0 @@

5

dist/error.d.ts
import { BettererErrorDetails } from './types';
export declare class BettererError extends Error {
code: symbol;
details: BettererErrorDetails;
constructor(code: symbol, ...details: BettererErrorDetails);
isBettererError: boolean;
constructor(message: string, ...details: BettererErrorDetails);
}
export declare function isBettererError(err: unknown): err is BettererError;

31

dist/error.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BettererError = void 0;
var tslib_1 = require("tslib");
var BettererError = /** @class */ (function (_super) {
tslib_1.__extends(BettererError, _super);
function BettererError(code) {
var _newTarget = this.constructor;
var details = [];
for (var _i = 1; _i < arguments.length; _i++) {
details[_i - 1] = arguments[_i];
}
var _this = _super.call(this) || this;
_this.code = code;
Error.captureStackTrace(_this, BettererError);
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.details = details;
return _this;
exports.isBettererError = exports.BettererError = void 0;
class BettererError extends Error {
constructor(message, ...details) {
super(message);
this.isBettererError = true;
Error.captureStackTrace(this, BettererError);
Object.setPrototypeOf(this, new.target.prototype);
this.details = details;
}
return BettererError;
}(Error));
}
exports.BettererError = BettererError;
function isBettererError(err) {
return !!err.isBettererError;
}
exports.isBettererError = isBettererError;
//# sourceMappingURL=error.js.map

@@ -1,3 +0,2 @@

export { BettererError } from './error';
export { logError, registerError } from './error-handler';
export * from './types';
export { BettererError, isBettererError } from './error';
export { BettererErrorDetail, BettererErrorDetails } from './types';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.registerError = exports.logError = exports.BettererError = void 0;
var tslib_1 = require("tslib");
exports.isBettererError = exports.BettererError = void 0;
var error_1 = require("./error");
Object.defineProperty(exports, "BettererError", { enumerable: true, get: function () { return error_1.BettererError; } });
var error_handler_1 = require("./error-handler");
Object.defineProperty(exports, "logError", { enumerable: true, get: function () { return error_handler_1.logError; } });
Object.defineProperty(exports, "registerError", { enumerable: true, get: function () { return error_handler_1.registerError; } });
tslib_1.__exportStar(require("./types"), exports);
Object.defineProperty(exports, "isBettererError", { enumerable: true, get: function () { return error_1.isBettererError; } });
//# sourceMappingURL=index.js.map
import { BettererError } from './error';
export declare type BettererErrorDetails = ReadonlyArray<string | Error | BettererError>;
export declare type BettererErrorFactory = (...details: BettererErrorDetails) => BettererError;
export declare type BettererErrorMessageFactory = (...details: BettererErrorDetails) => string;
export declare type ErrorLike = {
message: string;
stack: string;
};
export declare type BettererErrorDetail = string | Error | BettererError;
export declare type BettererErrorDetails = ReadonlyArray<BettererErrorDetail>;
{
"name": "@betterer/errors",
"description": "error handler for @betterer/betterer",
"version": "3.1.1",
"version": "4.0.0",
"license": "MIT",

@@ -24,8 +24,9 @@ "publishConfig": {

"scripts": {
"compile": "tsc -b ."
"compile": "tsc -b .",
"api": "ts-api-guardian --out ../../goldens/api/@betterer/errors.d.ts dist/index.d.ts"
},
"dependencies": {
"@betterer/logger": "^3.1.1"
"engines": {
"node": ">=12"
},
"gitHead": "1367466c849e75733e87ce55c4e84e44a173324e"
"gitHead": "e4068ade2596567bc53c6486280af3d882b40aa7"
}

@@ -1,2 +0,2 @@

[![Betterer](https://raw.githubusercontent.com/phenomnomnominal/betterer/master/docs/logo.png)](https://phenomnomnominal.github.io/betterer/)
[![Betterer](https://raw.githubusercontent.com/phenomnomnominal/betterer/master/website/static/img/header.png)](https://phenomnomnominal.github.io/betterer/)

@@ -7,30 +7,6 @@ # `@betterer/errors`

Error handler used within [**`Betterer`**](https://github.com/phenomnomnominal/betterer).
Error type used within [**`Betterer`**](https://github.com/phenomnomnominal/betterer).
## Usage
## Docs
### Register Error
Register an error type with the handler:
```typescript
import { registerError } from '@betterer/errors';
const MY_ERROR = registerError((details) => `Something went wrong: ${details}`);
```
### Log Error
Log a registered error type:
```typescript
import { logError, registerError } from '@betterer/errors';
const MY_ERROR = registerError(details => `Something went wrong: "${details}"`);
try {
throw MY_ERROR('OOPS!):
} catch (e) {
logError(e); // 'Something went wrong: "OOPS"'
}
```
[Check out the docs at `phenomnomnominal.github.io/betterer`! 🎉](https://phenomnomnominal.github.io/betterer/docs/error)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc