Function: tryGetErrorCode()
tryGetErrorCode(
error:unknown):string|undefined
Defined in: shared/utils/errorCodes.ts:16
Attempts to extract a stable string error code from an unknown error value.
Parametersโ
errorโ
unknown
Returnsโ
string | undefined
Remarksโ
Many Node/Electron APIs attach a string code property (e.g. ENOENT). This
helper centralizes the extraction to avoid scattered casts.
For example, instead of writing:
(error as { code?: unknown }).code;