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

Request to make OSError more descriptive #13192

Closed
kaushalmodi opened this issue Jan 18, 2020 · 3 comments
Closed

Request to make OSError more descriptive #13192

kaushalmodi opened this issue Jan 18, 2020 · 3 comments

Comments

@kaushalmodi
Copy link
Contributor

kaushalmodi commented Jan 18, 2020

Summary

Right now, if an OSError happens for not finding a file or directory, it's almost impossible to figure out what caused that error, because it does not print the file or directory it's trying to access.

Description

Here's an example error:

Hint: used config file '/home/kmodi/usr_local/apps/6/nim/devel/config/nim.cfg' [Conf]
Hint: used config file '/home/kmodi/usr_local/apps/6/nim/devel/config/config.nims' [Conf]
Hint: used config file '/home/kmodi/usr_local/apps/6/nim/devel/config/nimdoc.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: foo [Processing]
oserr.nim(94)            raiseOSError
Error: unhandled exception: No such file or directory [OSError]

Ref: #13191

Is it possible for that error to do these:

  1. Print the file/dir attempted to be accessed as well?
  2. Print a back trace of where this OSError got issued from. Example. If a copyFile call in nimdoc.nim caused this, the error should show that information.

Thanks.

@timotheecour
Copy link
Member

timotheecour commented Jan 19, 2020

duplicate of #8391

the fix is to extend what was done here #8393 to other procs; ideally simply show the minimal runtime information that's sufficient to debug what went wrong; eg:
raiseOSError(osLastError())
=>
raiseOSError(osLastError(), dir)

Print a back trace of where this OSError got issued from. Example. If a copyFile call in nimdoc.nim caused this, the error should show that information.

that's just a matter of adding --stacktrace:on

@sk-Prime
Copy link

sk-Prime commented Jan 3, 2021

Screenshot from 2021-01-02 22-00-31
here is another error message which can be improved. when copyFile proc got directory as argument this error message appear.
Improved error message should include "is not a file" sentence.

@timotheecour
Copy link
Member

here is another error message

=> transferred to #8391 (comment) since this issue is already closed

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

No branches or pull requests

4 participants