LaminaError
The one error class of @laminapdf/sdk (ADR 0026 §7). message, hint and didYouMean never
hold document text (ADR 0026 §4); that goes in data, marked untrusted on the code’s page at
docsUrl.
Example
Section titled “Example”try { Document.open(bytes, { password: "secret" });} catch (e) { if (isLaminaError(e, "wrong-password")) askAgain(); else throw e;}Extends
Section titled “Extends”Error
Type Parameters
Section titled “Type Parameters”C extends ErrorCode = ErrorCode
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new LaminaError<
C>(diagnostic,options?):LaminaError<C>
Parameters
Section titled “Parameters”diagnostic
Section titled “diagnostic”Diagnostic<C>
the ADR 0026 §1 object.
options?
Section titled “options?”cause, when wrapping another error.
cause?
Section titled “cause?”unknown
Returns
Section titled “Returns”LaminaError<C>
Overrides
Section titled “Overrides”Error.constructor
Properties
Section titled “Properties”cause?
Section titled “cause?”
optionalcause?:unknown
Inherited from
Section titled “Inherited from”Error.cause
readonlycode:C
The stable code (fixtures/codes.json).
readonlyoptionaldata?:Readonly<Record<string,unknown>>
Code-specific fields, documented on the code’s page (the only place document text appears).
didYouMean?
Section titled “didYouMean?”
readonlyoptionaldidYouMean?: readonlystring[]
For usage errors: the closest known names (lamina’s own vocabulary).
docsUrl
Section titled “docsUrl”
readonlydocsUrl:string
The code’s page.
readonlyoptionalhint?:string
One actionable sentence for this code.
readonlykind:ErrorKind
What the caller can do about it.
location?
Section titled “location?”
readonlyoptionallocation?:Location
Where in the input or the document.
message
Section titled “message”message:
string
Inherited from
Section titled “Inherited from”Error.message
readonlyname:"LaminaError"="LaminaError"
Overrides
Section titled “Overrides”Error.name
stack?
Section titled “stack?”
optionalstack?:string
Inherited from
Section titled “Inherited from”Error.stack
Accessors
Section titled “Accessors”ranges
Section titled “ranges”Get Signature
Section titled “Get Signature”get ranges(): readonly
object[] |undefined
For data-pending: the byte ranges a range document needs fetched before the call can
succeed (data.ranges); undefined for other codes. Document.ensure fetches them.
Returns
Section titled “Returns”readonly object[] | undefined
Methods
Section titled “Methods”toJSON()
Section titled “toJSON()”toJSON():
Diagnostic<C>
The ADR 0026 §1 object (for logs, workers and --json output); optional fields omitted.
Returns
Section titled “Returns”Diagnostic<C>