Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize error message casing to lowercase. #2267

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* [#2249](https://github.com/ruby-grape/grape/pull/2249): Split CI matrix, extract edge - [@dblock](https://github.com/dblock).
* [#2249](https://github.com/ruby-grape/grape/pull/2251): Upgraded to RuboCop 1.25.1 - [@dblock](https://github.com/dblock).
* [#2271](https://github.com/ruby-grape/grape/pull/2271): Fixed validation regression on Numeric type introduced in 1.3 - [@vasfed](https://github.com/Vasfed).
* [#2267](https://github.com/ruby-grape/grape/pull/2267): Standardized English error messages - [@dblock](https://github.com/dblock).
* Your contribution here.

#### Fixes
Expand Down
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