Jack Allen
Jack Allen

Reputation: 547

MVC: Show any exceptions thrown on the 'Error' page

I would like to edit my 'Error' page so that whenever an error is thrown it displays the reason why.

Instead of the default:

Error. An error occurred while processing your request.

It would say e.g.:

Error. An error occurred while processing your request.

Reason: "Unable to connect to database 'MVCDatabase'."

Is there a way of making it so that the 'Error' view would show this?

Upvotes: 1

Views: 492

Answers (1)

Chirag K
Chirag K

Reputation: 2434

You can use custom error messages and by using a little designing i.e giving them red colour you can store them as a variable in your model class and then simply show them on your page without breaking the visual layout and flow

Upvotes: 1

Related Questions