DocsPlaygroundBlogCommunityPackages
  • Playground
  • Blog
  • Community
  • Packages
  • X
  • Bluesky
  • GitHub
  • Forum
Language ManualAPISyntax LookupReact
Overview
Stdlib
submodules
  • Array
  • ArrayBuffer
  • AsyncIterator
  • BigInt
  • BigInt64Array
    • Constants
    BigUint64Array
    • Constants
  • Bool
  • Console
  • DataView
  • Date
    • UTC
  • Dict
  • Error
    • URIError
    • TypeError
    • SyntaxError
    • ReferenceError
    • RangeError
    • EvalError
  • Exn
    • t
      t
      D
    • v
      asJsExn
      D
    • v
      stack
      D
    • v
      message
      D
    • v
      name
      D
    • v
      fileName
      D
    • v
      anyToExnInternal
      D
    • v
      raiseError
      D
    • v
      raiseEvalError
      D
    • v
      raiseRangeError
      D
    • v
      raiseReferenceError
      D
    • v
      raiseSyntaxError
      D
    • v
      raiseTypeError
      D
    • v
      raiseUriError
      D
    • v
      ignore
      D
  • Float
    • Constants
    Float32Array
    • Constants
    Float64Array
    • Constants
    Int
    • Ref
    • Bitwise
    • Constants
    Int16Array
    • Constants
    Int32Array
    • Constants
    Int8Array
    • Constants
  • IntervalId
  • Intl
    • Segments
    • Segmenter
    • RelativeTimeFormat
    • PluralRules
    • NumberFormat
      • Grouping
    • Locale
    • ListFormat
    • DateTimeFormat
    • Collator
    • Common
  • Iterator
  • JSON
    • Decode
    • Encode
    • Classify
    JsError
    • URIError
    • TypeError
    • SyntaxError
    • ReferenceError
    • RangeError
    • EvalError
  • JsExn
  • Lazy
  • List
  • Map
  • Math
    • Int
    • Constants
  • Null
  • Nullable
  • Object
  • Option
  • Ordering
  • Pair
  • Promise
  • RegExp
    • Result
  • Result
  • Set
  • String
  • Symbol
  • TimeoutId
  • Type
    • Classify
  • TypedArray
  • Uint16Array
    • Constants
    Uint32Array
    • Constants
    Uint8Array
    • Constants
    Uint8ClampedArray
    • Constants
  • WeakMap
  • WeakSet
  • Docs / API / Stdlib / Exn

    Exn

    Provide utilities for dealing with JS exceptions.

    t

    Deprecated

    RESCRIPT
    type t

    Represents a JS exception

    asJsExn

    Deprecated

    RESCRIPT
    let asJsExn: exn => option<t>

    stack

    Deprecated

    RESCRIPT
    let stack: t => option<string>

    message

    Deprecated

    RESCRIPT
    let message: t => option<string>

    name

    Deprecated

    RESCRIPT
    let name: t => option<string>

    fileName

    Deprecated

    RESCRIPT
    let fileName: t => option<string>

    anyToExnInternal

    Deprecated

    RESCRIPT
    let anyToExnInternal: 'a => exn

    anyToExnInternal(obj) will take any value obj and wrap it in a Exn.Error if given value is not an exn already. If obj is an exn, it will return obj without any changes.

    This function is mostly useful for cases where you want to unify a type of a value that potentially is either exn, a JS error, or any other JS value really (e.g. for a value passed to a Promise.catch callback)

    IMPORTANT: This is an internal API and may be changed / removed any time in the future.

    raiseError

    Deprecated

    RESCRIPT
    let raiseError: string => 'a

    Raise Js exception Error object with stacktrace

    raiseEvalError

    Deprecated

    RESCRIPT
    let raiseEvalError: string => 'a

    raiseRangeError

    Deprecated

    RESCRIPT
    let raiseRangeError: string => 'a

    raiseReferenceError

    Deprecated

    RESCRIPT
    let raiseReferenceError: string => 'a

    raiseSyntaxError

    Deprecated

    RESCRIPT
    let raiseSyntaxError: string => 'a

    raiseTypeError

    Deprecated

    RESCRIPT
    let raiseTypeError: string => 'a

    raiseUriError

    Deprecated

    RESCRIPT
    let raiseUriError: string => 'a

    ignore

    Deprecated

    RESCRIPT
    let ignore: t => unit

    ignore(exn) ignores the provided exn and returns unit.

    This helper is useful when you want to discard a value (for example, the result of an operation with side effects) without having to store or process it further.

    Types and values
    • t
      t
      D
    • v
      asJsExn
      D
    • v
      stack
      D
    • v
      message
      D
    • v
      name
      D
    • v
      fileName
      D
    • v
      anyToExnInternal
      D
    • v
      raiseError
      D
    • v
      raiseEvalError
      D
    • v
      raiseRangeError
      D
    • v
      raiseReferenceError
      D
    • v
      raiseSyntaxError
      D
    • v
      raiseTypeError
      D
    • v
      raiseUriError
      D
    • v
      ignore
      D

    © 2025 The ReScript Project

    About
    • Community
    • ReScript Association
    Find us on