I am just starting out with Grails, obviously. I've created my domain class and controller, added my own logic to the controller, and everything is working properly -- as long as nothing goes wrong.
My custom controller action looks like this:
def create = {
try
{
// Get the parameters.
def uid=params["uid"]
def pwd=params["pwd"]
if (!uid || !pwd)
{
throw new Exception('User ID and password are required')
}
/* other code */
}
catch (Exception ex)
{
println ex.getMessage()
}
}
My code (/* other code */
) is working fine. When the exception is thrown, however, the error message is printed to the console and the browser throws a 404 error. Obviously, this isn't the way to go.
What's the correct way to do this?
TIA,
John