the error enum member representing this error type
Optional
errorDetails: stringoptional, additional details to include in the error message
if true
, the function will throw an Error
rather than
returning the string (defaults to false
).
In Libauth, expected errors use the type string
rather than Error
(or
other objects that inherit from Error
) to simplify the resulting types and
typechecking requirements. This ensures consistency of returned errors in all
environments, avoids exposing internal details like stack traces and line
numbers, and allows error messages to be recorded or used as text without an
intermediate toString()
method.
Generated using TypeDoc
A simple method used throughout Libauth to format error messages. By formatting errors this way, downstream consumers can detect specific error types by matching the
errorType
. For example, the error:Can be detected with
String.includes()
, even if theSomeTypeOfError.exceedsMaximum
error message changes:Using this method ensures consistency across the library.