Fix errors controller so that it works better. Add custom exception handling for api responses via the config setting in application.rb