Throw exceptions instead of redirection for errors