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

Unhelpful error message #15

Closed
Eneroth3 opened this issue May 10, 2019 · 2 comments
Closed

Unhelpful error message #15

Eneroth3 opened this issue May 10, 2019 · 2 comments

Comments

@Eneroth3
Copy link

Eneroth3 commented May 10, 2019

rescue DLError

When dlload in import.rb fails to load it raises an DLError with the message "can't load #{lib}". This is not a very helpful message as it doesn't say anything about why it couldn't load the library.

I've commented out some code for rescuing and re-raising so I could see the original error message, which to me was much more helpful.

Current:

          begin
            Fiddle.dlopen(lib)
          rescue DLError
            raise(DLError, "can't load #{lib}")
          end

Modified:

          #begin
            Fiddle.dlopen(lib)
          #rescue DLError
          #  raise(DLError, "can't load #{lib}")
          #end

Perhaps the original message can be included in the new one, or rescuing and re-raising could be removed in favor of the original exception.

Some background information: I'm very new to both Fiddle and C/C++ programming, but have been using Ruby for years. I've (tried to) compile my first ever DLL and use it in a Ruby project using Fiddle. When getting an error saying "Can't load", it is very hard to tell if I did something wrong with my DLL, if I've provided the wrong path or if I am using Fiddle incorrectly in any way.

@ankane
Copy link

ankane commented Feb 11, 2020

Hey @Eneroth3, not a maintainer, but one way to get around this is:

dlload Fiddle.dlopen(lib)

@kou kou closed this as completed in f3d70b8 Sep 27, 2020
@kou
Copy link
Member

kou commented Sep 27, 2020

Thanks.
It makes sense.

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

No branches or pull requests

3 participants