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

[ENHANCEMENT] fs - proper error handling #84

Open
DetachHead opened this issue Nov 2, 2020 · 1 comment
Open

[ENHANCEMENT] fs - proper error handling #84

DetachHead opened this issue Nov 2, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@DetachHead
Copy link
Contributor

Is your feature request related to a problem? Please describe.
currently I/O errors are caught in a try/catch and simply return true or false depending on whether or not it was successful.
image

this makes it difficult to debug as the return value false provides no information as to what went wrong

Describe the solution you'd like
these methods in FileSystem should just throw when they fail

Describe alternatives you've considered
perhaps a flag to change the error handling behavior, if you want the user to have the choice

Additional context
this made debugging difficult when implementing #83. i had to change the tryIfExists private method to throw instead when it fails, then changed it back such that it matches the behavior of the other targets.

@DetachHead DetachHead added the enhancement New feature or request label Nov 2, 2020
@suparngp
Copy link
Owner

suparngp commented Nov 4, 2020

I agree, this totally makes sense. I vaguely remember why I did it this way in the first place. I think it was somewhat complicated to create a neat API which throws errors on ios and thats probably why, I chose to suppress the errors and return a flag instead. But it has been an year, so I can't say for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants