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

Add more descriptive error to file loading #433

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TheBlackArroVV
Copy link

After trying to run it locally I found out, that an original error about the unavailability to run a file is not descriptive. So, I decided to add an error to make it more obvious.

@ZimbiX
Copy link
Member

ZimbiX commented Nov 23, 2024

Resolves #280 and #282.

imo the begin block should be removed so that errors from the require path or required code can be shown normally. And perhaps requiring using the full path to the given file.

@TheBlackArroVV
Copy link
Author

Hi, @ZimbiX,
Can you elaborate a bit about wdym? If you you mean just rendering a standard LoadError I think it's not gonna help with a problem I had, it would still be unclear how it should be used

@ZimbiX
Copy link
Member

ZimbiX commented Nov 26, 2024

Something like:

args.each do |file|
  require whatever_method_returns_a_full_file_path(file)
end

That way, all forms of relative file path can be accepted. Then if an exception is raised due to the given file not existing, that should be pretty easy to understand already, I'd think.

Edit: Looks like File.expand_path or File.realpath does the trick

@TheBlackArroVV
Copy link
Author

@ZimbiX, got it, makes sense
Can you check now?

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