global-error.js

The special file global-error.js serves as the top-most error boundary for the entire application, potentially catching errors from the root layout or template.

It is important to include the <html> and <body> tags when implementing the GlobalError component.

As of 25 Feb 2024, global-error.js has not been properly implemented by Next.js 14.1, although documentation of it has existed. (read this github issue)