Skip to content

Improved error messages for invalid field and invalid type errors#886

Open
jaggederest wants to merge 2 commits intoJSONAPI-Resources:masterfrom
jaggederest:improved_type_error_message
Open

Improved error messages for invalid field and invalid type errors#886
jaggederest wants to merge 2 commits intoJSONAPI-Resources:masterfrom
jaggederest:improved_type_error_message

Conversation

@jaggederest
Copy link
Copy Markdown

I ran into these errors and found them inscrutable, so I thought I would update the response strings with some suggestions about how to fix them.

We could extend this to other errors, as well, but I wanted to get feedback before I forged off into the wilderness too far.

Thanks, all feedback appreciated!

Justin

@lgebhardt
Copy link
Copy Markdown
Contributor

@jaggederest That sort of expanded error message seems good to me. Don't forget we need to change it in locales/en.yml as well.

@jaggederest
Copy link
Copy Markdown
Author

Will do, thanks for the feedback

@lgebhardt
Copy link
Copy Markdown
Contributor

@jaggederest I'm not sure if you've seen it, but one of the existing tests is failing due to the expanded error message:

Failure:
JSONAPIRequestTest#test_parse_dasherized_with_underscored_fields [/home/travis/build/cerebris/jsonapi-resources/test/unit/jsonapi_request/jsonapi_request_test.rb:141]:
--- expected
+++ actual
@@ -1 +1 @@
-"iso_currency is not a valid field for expense-entries."
+"iso_currency is not a valid field for expense-entries. Consider checking the spelling of the field name."
bin/rails test unit/jsonapi_request/jsonapi_request_test.rb:121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants