Version 1.0.0
@stackline/fault
Functional errors with formatted output
Independent maintenance of fault 2.0.1. Original authors and licenses are retained.
Installation
# Preserve existing imports with an npm alias
npm install fault@npm:@stackline/fault@1.0.0
# Or use the scoped package name in your imports
npm install @stackline/fault@1.0.0Node.js: See compatibility notes. Read the compatibility and maintenance notes before migrating.
Usage and API
The reference below may retain upstream package names. Use the alias installation above to run those imports with this Stackline release.
@stackline/fault
Independent maintenance fork of fault@2.0.1, preserving its API and published type declarations.
npm install @stackline/fault
# Keep existing imports:
npm install fault@npm:@stackline/fault@1.0.0
Stackline · Issues · Community
See UPSTREAM.md for source identity and issue review, and CHANGELOG.md for maintenance changes. Functional tests also run against the final npm tarball; releases are published from GitHub Actions with provenance.
Upstream documentation
fault
Functional errors with formatted output.
Contents
- What is this?
- When should I use this?
- Install
- Use
- API
- Types
- Compatibility
- Security
- Related
- Contribute
- License
What is this?
This package adds printf-like interpolation to errors.
When should I use this?
This package useful when you frequently display parameters in error messages and manual string concatenation is becoming verbose.
Install
This package is ESM only. In Node.js (version 12.20+, 14.14+, or 16.0+), install with npm:
npm install fault
In Deno with Skypack:
import {fault} from 'https://cdn.skypack.dev/fault@2?dts'
In browsers with Skypack:
<script type="module">
import {fault} from 'https://cdn.skypack.dev/fault@2?min'
</script>
Use
import {fault} from 'fault'
throw fault('Hello %s!', 'Eric')
Yields:
Error: Hello Eric!
at FormattedError (~/node_modules/fault/index.js:30:12)
at Object.<anonymous> (~/example.js:3:7)
…
Or, format a float in a type error:
import {fault} from 'fault'
throw fault.type('Who doesn’t like %f? 🍰', Math.PI)
Yields:
TypeError: Who doesn’t like 3.141593? 🍰
at Function.FormattedError [as type] (~/node_modules/fault/index.js:30:12)
at Object.<anonymous> (~/example.js:3:7)
API
This package exports the following identifiers: fault and create.
There is no default export.
fault(format?[, values…])
Create an error with a printf-like formatted message.
Parameters
format(string, optional) — template stringvalues(*, optional) — values to render informat
Returns
An Error instance.
Formatters
The following formatters are supported in format:
%s— string%b— binary%c— character%d— decimal%f— floating point%o— octal%x— lowercase hexadecimal%X— uppercase hexadecimal%followed by any other character, prints that character
See samsonjs/format for argument parsing.
Other errors
fault.eval(format?[, values…])— EvalErrorfault.range(format?[, values…])— RangeErrorfault.reference(format?[, values…])— ReferenceErrorfault.syntax(format?[, values…])— SyntaxErrorfault.type(format?[, values…])— TypeErrorfault.uri(format?[, values…])— URIError
create(Constructor)
Factory to create instances of ErrorConstructor with support for formatting.
Used internally to wrap the global error constructors and exposed for custom
errors.
Returns a function just like fault.
Types
This package is fully typed with TypeScript. There are no extra exported types.
Compatibility
This package is at least compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, and 16.0+. It also works in Deno and modern browsers.
Security
This package is safe.
Related
wooorm/bail— throw if given an error
Contribute
Yes please! See How to Contribute to Open Source.
License
Upstream issues and maintenance review
Upstream and maintenance review
This package maintains fault@2.0.1 under the independent @stackline/fault name.
- Source: https://github.com/wooorm/fault/tree/f2e9b858dae4683a04e437713fd3b2ee513a08e5
- Public npm artifact integrity:
sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==. - Upstream issue evidence checked: 2026-09-29T00:22:21.406941+00:00.
- Original license and author notices are retained.
- The upstream published runtime files and declarations are hash-checked in
.stackline/upstream.json. Any runtime fix is explicitly listed there. - Functional upstream suites run against the source and extracted final package. Development tools were reduced to those used by validation; full source and runtime audits must pass.
- Only direct dependencies of the original Stackline portfolio are in this migration. This is not a claim that all transitive projects are maintained by Stackline.
Issue triage
The queried open-issue list contained no issue entries. This does not establish that the upstream is abandoned or bug-free. No runtime bug fix is claimed for this initial maintenance release.
The evidence query fetched the latest 100 open and 30 closed issue/PR entries and removed PRs. Closed entries were collected for context; this report does not claim an exhaustive historic review.
Release discipline
The source commit, passing CI and CodeQL, reviewed CI tarball hash, npm provenance, normal and aliased installs, and immutable GitHub release are checked before a release is complete. Published versions and tags are never replaced.
Release changes
Changelog
1.0.0
- Start Stackline maintenance of the documented upstream API.
- Preserve and verify published runtime files and TypeScript declarations.
- Run upstream functional suites against both source and the final package.
- Publish the reviewed CI artifact through GitHub Actions with provenance and immutable release evidence.
Release files and references
Package bytes, npm provenance and the immutable GitHub release were verified for this version. Security checks describe the reviewed release; documented compatibility risks and upstream reports are not blanket claims of resolution.