Skip to content

Commit

Permalink
Standardize error message casing to lowercase.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Jun 15, 2022
1 parent ea5da50 commit 02333db
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
18 changes: 9 additions & 9 deletions lib/grape/locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ en:
except_values: 'has a value not allowed'
same_as: 'is not the same as %{parameter}'
missing_vendor_option:
problem: 'missing :vendor option.'
summary: 'when version using header, you must specify :vendor option. '
problem: 'missing :vendor option'
summary: 'when version using header, you must specify :vendor option'
resolution: "eg: version 'v1', using: :header, vendor: 'twitter'"
missing_mime_type:
problem: 'missing mime type for %{new_format}'
Expand All @@ -21,12 +21,12 @@ en:
or add your own with content_type :%{new_format}, 'application/%{new_format}'
"
invalid_with_option_for_represent:
problem: 'You must specify an entity class in the :with option.'
problem: 'you must specify an entity class in the :with option'
resolution: 'eg: represent User, :with => Entity::User'
missing_option: 'You must specify :%{option} options.'
missing_option: 'you must specify :%{option} options'
invalid_formatter: 'cannot convert %{klass} to %{to_format}'
invalid_versioner_option:
problem: 'Unknown :using for versioner: %{strategy}'
problem: 'unknown :using for versioner: %{strategy}'
resolution: 'available strategy for :using is :path, :header, :accept_version_header, :param'
unknown_validator: 'unknown validator: %{validator_type}'
unknown_options: 'unknown options: %{options}'
Expand All @@ -44,12 +44,12 @@ en:
"when specifying %{body_format} as content-type, you must pass valid
%{body_format} in the request's 'body'
"
empty_message_body: 'Empty message body supplied with %{body_format} content-type'
too_many_multipart_files: "The number of uploaded files exceeded the system's configured limit (%{limit})"
empty_message_body: 'empty message body supplied with %{body_format} content-type'
too_many_multipart_files: "the number of uploaded files exceeded the system's configured limit (%{limit})"
invalid_accept_header:
problem: 'Invalid accept header'
problem: 'invalid accept header'
resolution: '%{message}'
invalid_version_header:
problem: 'Invalid version header'
problem: 'invalid version header'
resolution: '%{message}'
invalid_response: 'Invalid response'
4 changes: 2 additions & 2 deletions spec/grape/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def app
end
post '/upload', { file: '' }, 'CONTENT_TYPE' => 'multipart/form-data; boundary=foobar'
expect(last_response.status).to eq(400)
expect(last_response.body).to eq('Empty message body supplied with multipart/form-data; boundary=foobar content-type')
expect(last_response.body).to eq('empty message body supplied with multipart/form-data; boundary=foobar content-type')
end
end

Expand All @@ -453,7 +453,7 @@ def app
end
post '/upload', { file: Rack::Test::UploadedFile.new(__FILE__, 'text/plain'), extra: Rack::Test::UploadedFile.new(__FILE__, 'text/plain') }
expect(last_response.status).to eq(413)
expect(last_response.body).to eq("The number of uploaded files exceeded the system's configured limit (1)")
expect(last_response.body).to eq("the number of uploaded files exceeded the system's configured limit (1)")
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/grape/exceptions/invalid_versioner_option_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

it 'contains the problem in the message' do
expect(error.message).to include(
'Unknown :using for versioner: headers'
'unknown :using for versioner: headers'
)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/grape/exceptions/missing_option_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

it 'contains the problem in the message' do
expect(error.message).to include(
'You must specify :path options.'
'you must specify :path options'
)
end
end
Expand Down

0 comments on commit 02333db

Please sign in to comment.