Docs
Core Concepts
Routing
Error Handling

Handling Error

When you encounter an error, Rasengan.js will throw an error message specifying the error type and the line number where the error occurred.

It's important for debugging purposes to know where the error occurred, but in production the error details should be hidden from the user.

Handling 404 Error

By default, Rasengan.js will throw a 404 error if the page is not found by providing a predifined 404 page.

You can customize the 404 page by creating a simple React Component and passing it to the AppRouter configuration.

Step 1: Create a 404 Page Component

It's not a PageComponent class but a simple React Component that will be used as a 404 page.

Step 2: Using the 404 Page Component

You now have to pass the 404 page component to the AppRouter configuration.

Step 3: Test the 404 Page

Now, if you navigate to a page that doesn't exist, you should see the 404 page you created.

With some simple styling, here is the result:

404 Page

You can provide a better UI for the 404 page by adding some CSS to the page.

Next Steps

Redirecting
Project Organization
Dynamic Routes
Logo Image