In this episode, we're diving into how to properly customize your error pages when building apps with Inertia.js and Laravel. Let's be honest, the default Laravel error pages are okay for quick development, but they start to feel clunky—especially once you're up and running in production. The big problem is those error modals that pop up when something's wrong; they're just not ideal for real users.
To start off, we look at the "old school" method: creating custom Blade views in the errors
folder (like 404.blade.php
), but with Inertia, these end up still showing up inside a modal, which isn’t what you want. Instead, the episode walks you through a much better approach:
Error.vue
page) and pass along the status code, so you can show different messages depending on the error.Head
component.We also address an important detail: making sure the actual HTTP response status matches the error, not just the page content. This helps keep things correct for things like crawlers or API clients.
Lastly, we talk about environments. You probably want to keep Laravel's default errors while developing (since they include useful debug info), but switch to your branded error pages in production. We show you how to add an environment variable so you can toggle custom error pages on and off, making it super flexible for both development and production.
By the end of this episode, your users will see smooth, custom error pages that feel like part of your app, not those out-of-place Laravel modals. And you'll have a setup that’s easy to tweak or expand later! 👌