Skip to content

Add a more descriptive error when spec load fails #5066

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

Merged
merged 4 commits into from
Oct 1, 2021

Conversation

johnnyshields
Copy link
Contributor

Raise a friendlier load error when running specs so that outside contributors know what to do.

@johnnyshields johnnyshields changed the title Add a more descriptive error when spec load failes Add a more descriptive error when spec load fails Sep 3, 2021
raise LoadError.new <<~MSG.strip
The test suite requires shared tooling to be installed.
Please refer to spec/README.md for instructions.
MSG
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this change, I think it is helpful.

Can you please include the original exception message in the new exception message using a pattern like

rescue LoadError => exc

raise LoadError, "...: #{exc.class}: #{exc}"

Copy link
Contributor Author

@johnnyshields johnnyshields Sep 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, since this is purely for development users in the console, I don't think it's useful to include the original error--it just makes it harder to read.

(If the original error was intelligible, I wouldn't have to make this PR :)

@p-mongo p-mongo merged commit 5565025 into mongodb:master Oct 1, 2021
p-mongo pushed a commit that referenced this pull request Oct 4, 2021
* Raise a friendlier load error when running specs so that outside contributors know what to do.

* show original exception

Co-authored-by: shields <shields@tablecheck.com>
Co-authored-by: Dmitry Rybakov <dmitry.rybakov@mongodb.com>
Co-authored-by: Oleg Pudeyev <code@olegp.name>
p-mongo pushed a commit to p-mongo/mongoid that referenced this pull request Oct 4, 2021
* Raise a friendlier load error when running specs so that outside contributors know what to do.

* show original exception

Co-authored-by: shields <shields@tablecheck.com>
Co-authored-by: Dmitry Rybakov <dmitry.rybakov@mongodb.com>
Co-authored-by: Oleg Pudeyev <code@olegp.name>
p-mongo pushed a commit to johnnyshields/mongoid that referenced this pull request Oct 5, 2021
* master:
  Remove remaining encoding declarations (mongodb#5088)
  Add a more descriptive error when spec load fails (mongodb#5066)
  MONGOID-5191 Proper order for after_create callback (mongodb#5087)
  MONGOID-5189 Proper order of *_save callbacks (mongodb#5083)
  MONGOID-5098 Standardize/improve Range queries -- .where(field: 1..3) (mongodb#5025)
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.

5 participants