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
Merged
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
16 changes: 12 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ def database_id_alt
"mongoid_test_alt"
end

require 'mrss/cluster_config'
require 'support/client_registry'
require 'mrss/constraints'
require 'mrss/event_subscriber'
begin
require 'mrss/cluster_config'
require 'support/client_registry'
require 'mrss/constraints'
require 'mrss/event_subscriber'
rescue LoadError => exc
raise LoadError.new <<~MSG.strip
The test suite requires shared tooling to be installed.
Please refer to spec/README.md for instructions.
#{exc.class}: #{exc}
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 :)

end

ClusterConfig = Mrss::ClusterConfig

Expand Down