mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 20:55:44 +02:00
Fix error generation
This commit is contained in:
parent
156ca0b54f
commit
89afe0bdf2
2 changed files with 3 additions and 3 deletions
|
@ -17,10 +17,10 @@ module Repp
|
||||||
@response = { code: 2303, message: 'Object does not exist' }
|
@response = { code: 2303, message: 'Object does not exist' }
|
||||||
render(json: @response, status: :not_found)
|
render(json: @response, status: :not_found)
|
||||||
rescue ActionController::ParameterMissing, Apipie::ParamMissing => e
|
rescue ActionController::ParameterMissing, Apipie::ParamMissing => e
|
||||||
@response = { code: 2003, message: e }
|
@response = { code: 2003, message: e.message.gsub(/\n/, '. ') }
|
||||||
render(json: @response, status: :bad_request)
|
render(json: @response, status: :bad_request)
|
||||||
rescue Apipie::ParamInvalid => e
|
rescue Apipie::ParamInvalid => e
|
||||||
@response = { code: 2005, message: e }
|
@response = { code: 2005, message: e.message.gsub(/\n/, '. ') }
|
||||||
render(json: @response, status: :bad_request)
|
render(json: @response, status: :bad_request)
|
||||||
ensure
|
ensure
|
||||||
create_repp_log
|
create_repp_log
|
||||||
|
|
|
@ -100,7 +100,7 @@ class APINameserversPutTest < ApplicationIntegrationTest
|
||||||
|
|
||||||
assert_response 400
|
assert_response 400
|
||||||
assert_equal ({ code: 2003,
|
assert_equal ({ code: 2003,
|
||||||
message: 'param is missing or the value is empty: hostname' }),
|
message: 'param is missing or the value is empty: hostname. Did you mean? hostname' }),
|
||||||
JSON.parse(response.body, symbolize_names: true)
|
JSON.parse(response.body, symbolize_names: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue