More Than Five
More Than Five

Reputation: 10429

Using ErrorController without raising exceptions

I see the Grails pattern, where you can configure your UrlMappings so that certain types of exceptions are handling in a specific Controller which returns specific responses to your client.

Very good.

However, is there anyway to invoke the functionality of your ErrorController without raising an exception?

For example, a user enters the wrong password - you don't want to throw an exception because it is not really an exception. Instead, you want a service to return an InvalidResponse to a Controller and you would love then for the Controller to delegate out to your ErrorController where you have your generic, error handling.

Can this be done?

Thanks

Upvotes: 0

Views: 81

Answers (1)

Mr. Cat
Mr. Cat

Reputation: 3552

You can use one of redirect, forward or chain to determine what to do in every case you have

Upvotes: 1

Related Questions