Skip to content

Commit 0706fe1

Browse files
authored
Merge pull request #2267 from dblock/standardize-errors
Standardize error message casing to lowercase.
2 parents fac0146 + 3b37b88 commit 0706fe1

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* [#2249](https://github.com/ruby-grape/grape/pull/2249): Split CI matrix, extract edge - [@dblock](https://github.com/dblock).
99
* [#2249](https://github.com/ruby-grape/grape/pull/2251): Upgraded to RuboCop 1.25.1 - [@dblock](https://github.com/dblock).
1010
* [#2271](https://github.com/ruby-grape/grape/pull/2271): Fixed validation regression on Numeric type introduced in 1.3 - [@vasfed](https://github.com/Vasfed).
11+
* [#2267](https://github.com/ruby-grape/grape/pull/2267): Standardized English error messages - [@dblock](https://github.com/dblock).
1112
* Your contribution here.
1213

1314
#### Fixes

lib/grape/locale/en.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ en:
1111
except_values: 'has a value not allowed'
1212
same_as: 'is not the same as %{parameter}'
1313
missing_vendor_option:
14-
problem: 'missing :vendor option.'
15-
summary: 'when version using header, you must specify :vendor option. '
14+
problem: 'missing :vendor option'
15+
summary: 'when version using header, you must specify :vendor option'
1616
resolution: "eg: version 'v1', using: :header, vendor: 'twitter'"
1717
missing_mime_type:
1818
problem: 'missing mime type for %{new_format}'
@@ -21,12 +21,12 @@ en:
2121
or add your own with content_type :%{new_format}, 'application/%{new_format}'
2222
"
2323
invalid_with_option_for_represent:
24-
problem: 'You must specify an entity class in the :with option.'
24+
problem: 'you must specify an entity class in the :with option'
2525
resolution: 'eg: represent User, :with => Entity::User'
26-
missing_option: 'You must specify :%{option} options.'
26+
missing_option: 'you must specify :%{option} options'
2727
invalid_formatter: 'cannot convert %{klass} to %{to_format}'
2828
invalid_versioner_option:
29-
problem: 'Unknown :using for versioner: %{strategy}'
29+
problem: 'unknown :using for versioner: %{strategy}'
3030
resolution: 'available strategy for :using is :path, :header, :accept_version_header, :param'
3131
unknown_validator: 'unknown validator: %{validator_type}'
3232
unknown_options: 'unknown options: %{options}'
@@ -44,12 +44,12 @@ en:
4444
"when specifying %{body_format} as content-type, you must pass valid
4545
%{body_format} in the request's 'body'
4646
"
47-
empty_message_body: 'Empty message body supplied with %{body_format} content-type'
48-
too_many_multipart_files: "The number of uploaded files exceeded the system's configured limit (%{limit})"
47+
empty_message_body: 'empty message body supplied with %{body_format} content-type'
48+
too_many_multipart_files: "the number of uploaded files exceeded the system's configured limit (%{limit})"
4949
invalid_accept_header:
50-
problem: 'Invalid accept header'
50+
problem: 'invalid accept header'
5151
resolution: '%{message}'
5252
invalid_version_header:
53-
problem: 'Invalid version header'
53+
problem: 'invalid version header'
5454
resolution: '%{message}'
5555
invalid_response: 'Invalid response'

spec/grape/endpoint_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def app
432432
end
433433
post '/upload', { file: '' }, 'CONTENT_TYPE' => 'multipart/form-data; boundary=foobar'
434434
expect(last_response.status).to eq(400)
435-
expect(last_response.body).to eq('Empty message body supplied with multipart/form-data; boundary=foobar content-type')
435+
expect(last_response.body).to eq('empty message body supplied with multipart/form-data; boundary=foobar content-type')
436436
end
437437
end
438438

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

spec/grape/exceptions/invalid_versioner_option_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
it 'contains the problem in the message' do
1010
expect(error.message).to include(
11-
'Unknown :using for versioner: headers'
11+
'unknown :using for versioner: headers'
1212
)
1313
end
1414
end

spec/grape/exceptions/missing_option_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
it 'contains the problem in the message' do
1010
expect(error.message).to include(
11-
'You must specify :path options.'
11+
'you must specify :path options'
1212
)
1313
end
1414
end

0 commit comments

Comments
 (0)