0.3.0 • Published 6 months ago

error-value v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Errors as values

Error constructor for Maybe Monads.

Features

  • code first, message optional
  • instance of Error
  • no stack trace
  • serializable

Examples

import { Err } from 'error-value'
const err = Err('BAD')

console.log(err instanceof Error) // true
console.log(err.code) // 'BAD'
const err = Err('BAD', 'Something bad happened')

console.log(err.message) // 'Something bad happened'
const err = Err('BAD', { foo: 'bar' })

console.log(err.foo) // 'bar'
console.log(JSON.stringify(err)) // '{"code":"BAD","foo":"bar"}'
0.3.0

6 months ago

0.2.4

6 months ago

0.2.3

6 months ago

0.2.2

6 months ago

0.2.1

6 months ago

0.2.0

6 months ago

0.1.0

6 months ago