Skip to content

Instantly share code, notes, and snippets.

@FlorianWendelborn
Created September 10, 2025 16:50
Show Gist options
  • Select an option

  • Save FlorianWendelborn/b557f483bb6b46a4b1bf307fb8948e9d to your computer and use it in GitHub Desktop.

Select an option

Save FlorianWendelborn/b557f483bb6b46a4b1bf307fb8948e9d to your computer and use it in GitHub Desktop.
export const isError = (error: unknown): error is Error =>
typeof error === "object" &&
error !== null &&
"name" in error &&
typeof error.name === "string" &&
(("stack" in error && typeof error.stack === "string") ||
error instanceof Error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment