New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@perfective/error

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@perfective/error - npm Package Compare versions

Comparing version 0.2.0-beta to 0.2.0

2

dist/cjs/error/error.js

@@ -17,3 +17,3 @@ "use strict";

function errorOutput(error) {
return `${error.name}: ${error.message}`;
return `${error.name}: ${error.message}`.replace(/: $/u, '');
}

@@ -20,0 +20,0 @@ exports.errorOutput = errorOutput;

@@ -15,2 +15,3 @@ import { ExceptionContext } from './exception-context';

export declare function causedBy(previous: Error, message: string, tokens?: ExceptionTokens, context?: ExceptionContext): Exception;
export declare function unknownError(error: unknown): Error | Exception;
export declare function isException<T>(value: Exception | T): value is Exception;

@@ -17,0 +18,0 @@ export declare function isNotException<T>(value: Exception | T): value is T;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unchained = exports.fault = exports.chainStack = exports.isNotException = exports.isException = exports.causedBy = exports.exception = exports.Exception = void 0;
exports.unchained = exports.fault = exports.chainStack = exports.isNotException = exports.isException = exports.unknownError = exports.causedBy = exports.exception = exports.Exception = void 0;
const error_1 = require("../error/error");

@@ -30,2 +30,8 @@ const exception_message_1 = require("./exception-message");

exports.causedBy = causedBy;
function unknownError(error) {
return error_1.isError(error)
? error
: exception('Literal error', {}, { error });
}
exports.unknownError = unknownError;
function isException(value) {

@@ -32,0 +38,0 @@ return value instanceof Exception;

@@ -11,3 +11,3 @@ export function error(message) {

export function errorOutput(error) {
return `${error.name}: ${error.message}`;
return `${error.name}: ${error.message}`.replace(/: $/u, '');
}

@@ -14,0 +14,0 @@ export function stack(error) {

@@ -15,2 +15,3 @@ import { ExceptionContext } from './exception-context';

export declare function causedBy(previous: Error, message: string, tokens?: ExceptionTokens, context?: ExceptionContext): Exception;
export declare function unknownError(error: unknown): Error | Exception;
export declare function isException<T>(value: Exception | T): value is Exception;

@@ -17,0 +18,0 @@ export declare function isNotException<T>(value: Exception | T): value is T;

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

import { errorOutput, stack } from '../error/error';
import { errorOutput, isError, stack } from '../error/error';
import { exceptionMessage, exceptionMessageOutput } from './exception-message';

@@ -24,2 +24,7 @@ export class Exception extends Error {

}
export function unknownError(error) {
return isError(error)
? error
: exception('Literal error', {}, { error });
}
export function isException(value) {

@@ -26,0 +31,0 @@ return value instanceof Exception;

{
"name": "@perfective/error",
"version": "0.2.0-beta",
"version": "0.2.0",
"description": "Functions for the Error and other types to handle exceptions",

@@ -5,0 +5,0 @@ "keywords": [

@@ -5,3 +5,3 @@ # Error

It defines an `Exception`, based on the JS
[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) class
[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) class,
that supports localizable error messages and error chaining;

@@ -20,2 +20,4 @@ and provides functions to handle error stack output.

— creates an `Exception` with a previous error.
* `unknownError(error: unknown): Error | Exception`
— returns a passed `Error` or creates a new `Literal error` `Exception`.
* `isException<T>(value: Exception | T): value is Exception`

@@ -22,0 +24,0 @@ — returns `true` when value is an `Exception`.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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