8 lines
255 B
TypeScript
8 lines
255 B
TypeScript
export function getErrnoCode(error: unknown): string | undefined {
|
|
if (typeof error !== 'object' || error === null) {
|
|
return undefined
|
|
}
|
|
const rec = error as Record<string, unknown>
|
|
return typeof rec.code === 'string' ? rec.code : undefined
|
|
}
|