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

update FileSystem module to use error handling #7174

Merged
merged 1 commit into from Sep 7, 2017

Conversation

psahabu
Copy link

@psahabu psahabu commented Aug 31, 2017

Several procedures in FileSystem would halt if they encountered an error, but this PR enables users to handle a SystemError if they prefer. No tests were handling syserr from FileSystem.

  • passes linux64+flat testing

var err: syserr = ENOERR;
chdir(err, name);
if err != ENOERR then ioerror(err, "in chdir", name);
if err != ENOERR then try ioerror(err, "in chdir", name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little surprised these are trys instead of direct throws, though I'm assuming ioerror is a function that throws?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I say that because the intention of those statements is that if we enter the then block, we are in an error situation and so it would be problematic not to throw if that's the behavior we should perform (as opposed to halting)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, ioerror() is a function that throws if an err is passed to it. It was easier to change the code in ioerror once rather than replace all calls with a throw, at least for now.

@psahabu psahabu merged commit 716fa58 into chapel-lang:master Sep 7, 2017
@psahabu psahabu deleted the errhand-fs branch September 11, 2017 19:32
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.

None yet

2 participants