DocsPlaygroundBlogCommunity
  • Playground
  • Blog
  • Community
  • X
  • Bluesky
  • GitHub
  • Forum
Language ManualAPISyntax LookupReact
Overview
Js
submodules
  • Array
  • Array2
  • BigInt
  • Blob
  • Console
  • Date
  • Dict
  • 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
  • File
  • Float
  • Global
  • Int
  • Json
    • Kind
  • Map
  • Math
  • Null
  • Null_undefined
  • Nullable
  • Obj
  • Option
  • Promise
  • Promise2
  • Re
  • Result
  • Set
  • String
  • String2
  • TypedArray2
    • DataView
    • Float64Array
    • Float32Array
    • Uint32Array
    • Int32Array
    • Uint16Array
    • Int16Array
    • Uint8ClampedArray
    • Uint8Array
    • Int8Array
    • ArrayBuffer
    Typed_array
    • DataView
    • Float64_array
    • Float64Array
    • Float32_array
    • Float32Array
    • Uint32Array
    • Int32_array
    • Int32Array
    • Uint16Array
    • Int16Array
    • Uint8ClampedArray
    • Uint8Array
    • Int8Array
    • S
    • ArrayBuffer
    • Type
  • Types
  • Undefined
  • WeakMap
  • WeakSet
  • API / Js / Exn

    Exn

    Provide utilities for dealing with JS exceptions.

    t

    Deprecated

    Use JsExn.t instead

    RESCRIPT
    type t

    Represents a JS exception

    asJsExn

    Deprecated

    Use JsExn.fromException instead

    RESCRIPT
    let asJsExn: exn => option<t>

    stack

    Deprecated

    Use JsExn.stack instead

    RESCRIPT
    let stack: t => option<string>

    message

    Deprecated

    Use JsExn.message instead

    RESCRIPT
    let message: t => option<string>

    name

    Deprecated

    Use JsExn.name instead

    RESCRIPT
    let name: t => option<string>

    fileName

    Deprecated

    Use JsExn.fileName instead

    RESCRIPT
    let fileName: t => option<string>

    anyToExnInternal

    Deprecated

    Use JsExn.anyToExnInternal instead

    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

    Use JsError.throwWithMessage instead

    RESCRIPT
    let raiseError: string => 'a

    Raise Js exception Error object with stacktrace

    raiseEvalError

    Deprecated

    Use JsError.EvalError.throwWithMessage instead

    RESCRIPT
    let raiseEvalError: string => 'a

    raiseRangeError

    Deprecated

    Use JsError.RangeError.throwWithMessage instead

    RESCRIPT
    let raiseRangeError: string => 'a

    raiseReferenceError

    Deprecated

    Use JsError.ReferenceError.throwWithMessage instead

    RESCRIPT
    let raiseReferenceError: string => 'a

    raiseSyntaxError

    Deprecated

    Use JsError.SyntaxError.throwWithMessage instead

    RESCRIPT
    let raiseSyntaxError: string => 'a

    raiseTypeError

    Deprecated

    Use JsError.TypeError.throwWithMessage instead

    RESCRIPT
    let raiseTypeError: string => 'a

    raiseUriError

    Deprecated

    Use JsError.URIError.throwWithMessage instead

    RESCRIPT
    let raiseUriError: string => 'a

    ignore

    Deprecated

    Use JsExn.ignore instead

    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