vlt / docs

  • PricingBenchmarks (opens in new window)Community (opens in new window)Feedback
  • Overview
    • Overview
    • Reference
  • Type Aliases
  • Codes
  • DuckTypeManifest
  • ErrorCauseOptions
  • ErrorCtor()<T>
  • Functions
  • error()
  • syntaxError()
  • typeError()
  1. Client
  2. /
  3. API Reference
  4. /
  5. @vltpkg/error-cause
  6. /
  7. Reference

Reference

Type Aliases

Codes

TypeScript
type Codes = 
  | "EEXIST"
  | "EINTEGRITY"
  | "EINVAL"
  | "ELIFECYCLE"
  | "EMAXREDIRECT"
  | "ENEEDAUTH"
  | "ENOENT"
  | "ENOGIT"
  | "ERESOLVE"
  | "EUNKNOWN"
  | "EUSAGE"
  | "EQUERY"
  | "EREQUEST"
  | "ECONFIG"
  | "ELOCKFILEVERSION"
  | "EINVALIDNAME";

Defined in: index.ts:196

Valid properties for the 'code' field in an Error cause. Add new options to this list as needed.


DuckTypeManifest

TypeScript
type DuckTypeManifest = Record<string, any> & object;

Defined in: index.ts:172

Type declaration

NameType
arch?string[] | string
deprecated?string
dist?object
dist.fileCount?number
dist.integrity?string
dist.shasum?string
dist.signatures?object[]
dist.tarball?string
dist.unpackedSize?number
engines?Record<string, string>
name?string
os?string[] | string
version?string

ErrorCauseOptions

TypeScript
type ErrorCauseOptions = object;

Defined in: index.ts:13

Codification of vlt's Error.cause conventions

Add new properties to this list as needed.

Several of these types are just very basic duck-typing, because referencing internal types directly would create a workspace dependency cycle.

Type declaration

NameTypeDescription
args?string[]the arguments passed to a process
cause?unknownThe cause field within a cause object should always be an Error object that was previously thrown. Note that the cause on an Error itself might also be a previously thrown error, if no additional information could be usefully added beyond improving the message. It is typed as unknown because we use useUnknownInCatchVariables so this makes it easier to rethrow a caught error without recasting it.
code?CodesThis should only be a string code that we set. See Codes for the supported options. Lower-level system codes like ENOENT should remain on the errors that generated them.
command?stringa command being run in a child process
cwd?stringthe current working directory of a process
found?unknownactual value, which was not wanted
from?stringfile path origin of a resolution that failed, for example in the case of file:// specifiers.
manifest?DuckTypeManifesta package manifest, either from package.json or a registry
max?unknownmaximum value, which was exceeded
method?stringHTTP method
min?unknownminimum value, which was not met
name?stringthe name of something
offset?numberbyte offset in a Buffer or file
packument?objectregistry top-level package document
packument.dist-tagsRecord<string, string>-
packument.namestring-
packument.time?Record<string, string>-
packument.versionsRecord<string, DuckTypeManifest>-
path?stringtarget of a file system operation
projectRoot?stringthe root of a project
range?| string | { `[k: stringnumber
repository?stringgit repository remote or path
response?| IncomingMessage | Response | { `[k: stringnumber
signal?NodeJS.Signals | nullnull or a signal that a process received
spec?| string | { `[k: stringnumber
status?number | nullexit code of a process, or HTTP response status code
stderr?Buffer | string | nullstandard error from a process
stdout?Buffer | string | nullstandard output from a process
target?stringpath on disk that is being written, linked, or extracted to
todo?stringmessage indicating what bit of work this might be a part of, what feature needs to be implemented, etc. Eg, { todo: 'nested workspace support' }.
url?URL | stringstring or URL object
validOptions?unknown[] | readonly unknown[]Array of valid options when something is not a valid option. (For use in did you mean X? output.)
version?| string | { `[k: stringnumber
wanted?unknownA desired value that was not found, or a regular expression or other pattern describing it.

ErrorCtor()<T>

TypeScript
type ErrorCtor<T> = (message, options?) => T;

Defined in: index.ts:220

Type Parameters

Type Parameter
T extends Error

Parameters

ParameterType
messagestring
options?{ cause: Error | ErrorCauseOptions; }
options.cause?Error | ErrorCauseOptions

Returns

T

Functions

error()

Call Signature

TypeScript
function error(
   message, 
   cause?, 
   from?): Error

Defined in: index.ts:258

Parameters
ParameterType
messagestring
cause?undefined
from?Function
Returns

Error

Call Signature

TypeScript
function error(
   message, 
   cause, 
   from?): Error & object

Defined in: index.ts:263

Parameters
ParameterType
messagestring
causeError
from?Function
Returns

Error & object

Call Signature

TypeScript
function error(
   message, 
   cause, 
   from?): Error & object

Defined in: index.ts:268

Parameters
ParameterType
messagestring
causeErrorCauseOptions
from?Function
Returns

Error & object


syntaxError()

Call Signature

TypeScript
function syntaxError(
   message, 
   cause?, 
   from?): SyntaxError

Defined in: index.ts:304

Parameters
ParameterType
messagestring
cause?undefined
from?Function
Returns

SyntaxError

Call Signature

TypeScript
function syntaxError(
   message, 
   cause, 
   from?): SyntaxError & object

Defined in: index.ts:309

Parameters
ParameterType
messagestring
causeError
from?Function
Returns

SyntaxError & object

Call Signature

TypeScript
function syntaxError(
   message, 
   cause, 
   from?): SyntaxError & object

Defined in: index.ts:314

Parameters
ParameterType
messagestring
causeErrorCauseOptions
from?Function
Returns

SyntaxError & object


typeError()

Call Signature

TypeScript
function typeError(
   message, 
   cause?, 
   from?): TypeError

Defined in: index.ts:281

Parameters
ParameterType
messagestring
cause?undefined
from?Function
Returns

TypeError

Call Signature

TypeScript
function typeError(
   message, 
   cause, 
   from?): TypeError & object

Defined in: index.ts:286

Parameters
ParameterType
messagestring
causeError
from?Function
Returns

TypeError & object

Call Signature

TypeScript
function typeError(
   message, 
   cause, 
   from?): TypeError & object

Defined in: index.ts:291

Parameters
ParameterType
messagestring
causeErrorCauseOptions
from?Function
Returns

TypeError & object


Previous@vltpkg/error-causeNext@vltpkg/fast-split

On this page

  • Type Aliases
  • Codes
  • DuckTypeManifest
  • ErrorCauseOptions
  • ErrorCtor()<T>
  • Functions
  • error()
  • syntaxError()
  • typeError()

Deploy your package on vlt.io

Publish scoped and private packages, manage organizations and access, and give every developer and CI environment a consistent source for public and private JavaScript dependencies.

Publish now