Next.js Discord

Discord Forum

Custom Error Handler

Unanswered
Seppala Siberian Sleddog posted this in #help-forum
Open in Discord
Seppala Siberian SleddogOP
Can I use the error.tsx file to handle custom errors, as it seems to be it accepts only object from the Error type only?
I want something like this to evalute to true

export interface ErrorProps {
  error: Error & {
    digest?: string;
  };
  reset: () => void;
}

const Error: React.FC<ErrorProps> = ({ error }) => {
  console.log(error instanceof CustomError);

};

0 Replies