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

modern-errors

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modern-errors - npm Package Compare versions

Comparing version 5.3.1 to 5.4.0

22

build/src/main.d.ts

@@ -1,19 +0,11 @@

import type { ErrorInstance } from './merge/cause.js'
import type { ClassOptions } from './options/class.js'
import type { InstanceOptions } from './options/instance.js'
import type { MethodOptions } from './options/method.js'
import type { Info } from './plugins/info/main.js'
import type { Plugin } from './plugins/shape/main.js'
import type { ErrorClass, SpecificErrorClass } from './subclass/create.js'
import type { CustomClass } from './subclass/custom.js'
export type {
Plugin,
Info,
MethodOptions,
InstanceOptions,
ClassOptions,
ErrorInstance,
ErrorClass,
}
export type { ErrorInstance } from './merge/cause.js'
export type { ClassOptions } from './options/class.js'
export type { InstanceOptions } from './options/instance.js'
export type { MethodOptions } from './options/method.js'
export type { Info } from './plugins/info/main.js'
export type { Plugin } from './plugins/shape/main.js'
export type { ErrorClass }

@@ -20,0 +12,0 @@ /**

@@ -8,2 +8,3 @@ import type { Cause, NormalizedCause } from '../options/instance.js'

import type { SetProps } from '../utils/omit.js'
import type { AggregateErrors, AggregateErrorsProperty } from './aggregate.js'

@@ -10,0 +11,0 @@

import type { ErrorProps } from '../plugins/core/props/main.js'
import type { Plugins } from '../plugins/shape/main.js'
import type { CustomClass } from '../subclass/custom.js'
import type { PluginsOptions } from './plugins.js'

@@ -5,0 +6,0 @@

import type { AggregateErrors } from '../merge/aggregate.js'
import type { ErrorProps } from '../plugins/core/props/main.js'
import type { Plugins } from '../plugins/shape/main.js'
import type { PluginsOptions } from './plugins.js'

@@ -16,3 +17,3 @@

*/
export type Cause = unknown | undefined
export type Cause = unknown

@@ -22,6 +23,6 @@ /**

*/
type MainInstanceOptions<
interface MainInstanceOptions<
AggregateErrorsArg extends AggregateErrors,
CauseArg extends Cause,
> = {
> {
/**

@@ -28,0 +29,0 @@ * The `errors` option aggregates multiple errors into one. This is like

import type { Plugin } from '../plugins/shape/main.js'
import type { ExternalPluginOptions } from './plugins.js'

@@ -3,0 +4,0 @@

@@ -34,3 +34,3 @@ import type { ErrorProps } from '../plugins/core/props/main.js'

*/
type CorePluginsOptions<ChildProps extends ErrorProps> = {
interface CorePluginsOptions<ChildProps extends ErrorProps> {
/**

@@ -37,0 +37,0 @@ * Error properties.

import type { ErrorInstance } from '../../merge/cause.js'
import type { ErrorClass } from '../../subclass/create.js'
import type { Plugins } from '../shape/main.js'

@@ -34,3 +33,4 @@ /**

* },
* // `new ErrorClass('message', { example: value })` sets `error.example: value`
* // `new ErrorClass('message', { example: value })` sets
* // `error.example: value`
* properties({ options }) {

@@ -59,3 +59,3 @@ * return { example: options }

*/
readonly ErrorClass: ErrorClass<Plugins>
readonly ErrorClass: ErrorClass

@@ -93,3 +93,7 @@ /**

* const { options } = errorInfo(error)
* console.error(options.example?.stack ? error.stack : error.message)
* console.error(
* options.example?.stack
* ? error.stack
* : error.message
* )
* })

@@ -159,3 +163,3 @@ * }

type UntypedInfo<SpecificInfo> = {
[InfoPropName in keyof SpecificInfo]: never
readonly [InfoPropName in keyof SpecificInfo]: never
}

@@ -168,3 +172,3 @@

export type InfoParameter = {
[InfoName in keyof Info]: UntypedInfo<Info[InfoName]>
readonly [InfoName in keyof Info]: UntypedInfo<Info[InfoName]>
}

@@ -6,3 +6,3 @@ import type { MethodOptions } from '../../options/method.js'

import type { InstanceMethod, InstanceMethods } from './main.js'
import type { InstanceMethods, InstanceMethod } from './main.js'

@@ -9,0 +9,0 @@ /**

import type { MethodOptions } from '../../options/method.js'
import type { UnionToIntersection } from '../../utils/intersect.js'
import type { SliceFirst } from '../../utils/slice.js'
import type { InstanceMethod, InstanceMethods } from './main.js'
import type { Plugin, Plugins } from '../shape/main.js'
import type { InstanceMethod, InstanceMethods } from './main.js'
/**

@@ -8,0 +9,0 @@ * Bound mixed method parameters

@@ -142,3 +142,4 @@ import type { GetOptions, IsOptions } from '../../options/get.js'

* name: 'example',
* // `ErrorClass.concatMessage(error, "one")` or `error.concatMessage("one")`
* // `ErrorClass.concatMessage(error, "one")` or
* // `error.concatMessage("one")`
* // return `${error.message} - one`

@@ -145,0 +146,0 @@ * instanceMethods: {

@@ -12,2 +12,3 @@ import type { ErrorName } from 'error-custom-class'

import type { OmitKeys } from '../utils/omit.js'
import type {

@@ -14,0 +15,0 @@ CustomClass,

@@ -13,3 +13,3 @@ import type { AggregateErrors } from '../merge/aggregate.js'

*/
export type CustomClass = {
export interface CustomClass {
new (message: string, options?: InstanceOptions): Error

@@ -16,0 +16,0 @@ subclass: unknown

@@ -9,2 +9,3 @@ import type {

import type { SetProps } from '../utils/omit.js'
import type { SpecificErrorClass } from './create.js'

@@ -21,3 +22,3 @@ import type { CustomClass } from './custom.js'

> = <
ErrorArg extends unknown,
ErrorArg,
NewErrorClass extends SpecificErrorClass<

@@ -42,3 +43,3 @@ PluginsArg,

type NormalizeDeepError<
ErrorArg extends unknown,
ErrorArg,
ParentError extends ErrorInstance,

@@ -77,3 +78,3 @@ NewError extends ErrorInstance,

type NormalizeOneError<
ErrorArg extends unknown,
ErrorArg,
ParentError extends ErrorInstance,

@@ -80,0 +81,0 @@ NewError extends ErrorInstance,

@@ -5,5 +5,5 @@ /**

export type UnionToIntersection<T> = (
T extends any ? (arg: T) => any : never
) extends (arg: infer U) => any
T extends unknown ? (arg: T) => unknown : never
) extends (arg: infer U) => unknown
? U
: never

@@ -6,3 +6,3 @@ /**

export type OmitKeys<
Source extends unknown,
Source,
OmittedKeys extends PropertyKey,

@@ -9,0 +9,0 @@ > = keyof Source extends OmittedKeys ? {} : Omit<Source, OmittedKeys>

{
"name": "modern-errors",
"version": "5.3.1",
"version": "5.4.0",
"type": "module",

@@ -56,3 +56,3 @@ "exports": {

"dependencies": {
"error-class-utils": "^2.4.0",
"error-class-utils": "^2.5.0",
"error-custom-class": "^8.4.0",

@@ -68,4 +68,4 @@ "filter-obj": "^5.1.0",

"devDependencies": {
"@ehmicky/dev-tasks": "^2.0.4",
"is-error-instance": "^1.3.0",
"@ehmicky/dev-tasks": "^2.0.52",
"is-error-instance": "^1.5.0",
"modern-errors-bugs": "^2.1.0",

@@ -72,0 +72,0 @@ "modern-errors-clean": "^3.1.0",

@@ -126,3 +126,3 @@ <picture>

This package works in both Node.js >=14.18.0 and
[browsers](https://raw.githubusercontent.com/ehmicky/dev-tasks/main/src/tasks/build/browserslist).
[browsers](https://raw.githubusercontent.com/ehmicky/dev-tasks/main/src/browserslist).
It is an ES module and must be loaded using

@@ -129,0 +129,0 @@ [an `import` or `import()` statement](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c),

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