errorMessage
errorMessage(
err):string
Defined in: error-message.ts:18
Stringifies a caught value for display — err.message for a real
Error, String(err) for anything else (a thrown string, a plugin’s
custom error-like object, …). catch blocks only ever get unknown
in TypeScript, so this is the one line nearly every one of them needs.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”string
Example
Section titled “Example”import { errorMessage } from "@theholocron/misc-utils";
try { doSomething();} catch (err) { console.error(errorMessage(err));}