Function isErrorWithCode

  • Type guard for determining whether the given value is an error object with a code property such as the type of error that Node throws for filesystem operations, etc.

    Returns

    A boolean.

    Parameters

    • error: unknown

      The object to check.

    Returns error is {
        code: string;
    }