Skip to content

Commit

Permalink
Raise more specific error on db error
Browse files Browse the repository at this point in the history
[#95107930]
  • Loading branch information
Gerg committed Jun 30, 2015
1 parent 32e6952 commit 0e0de33
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/base/base_controller.rb
Expand Up @@ -302,7 +302,7 @@ def translate_and_log_exception(logger, e)
msg[0] = msg[0] + ':'
msg.concat(e.backtrace).join('\\n')
logger.warn(msg.join('\\n'))
Errors::ApiError.new_from_details('ServerError')
Errors::ApiError.new_from_details('DatabaseError')
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/controllers/base/base_controller_spec.rb
Expand Up @@ -109,7 +109,7 @@ def self.translate_validation_exception(error, attrs)
it 'logs the error when a Sequel Database Error occurs' do
expect(logger).to receive(:warn).with(/exception not translated/)
get '/test_database_error', '', headers_for(user)
expect(decoded_response['code']).to eq 10001
expect(decoded_response['code']).to eq 10011
end

it 'logs an error when a JSON error occurs' do
Expand Down
2 changes: 1 addition & 1 deletion vendor/errors

0 comments on commit 0e0de33

Please sign in to comment.