Skip to main content

Errors

import { assert, createCustomError, getErrorMessage } from '@rtorcato/js-common/errors'

Exports

NameSummary
assertThrows an error if the condition is false.
createCustomErrorCreates a new Error with a custom name and message.
getErrorMessageGets the error message from an unknown error value.
isErrorNameChecks if an error is an instance of a specific error name.
tryWithFallbackWraps a function and catches errors, returning a fallback value if an error occurs.