-
Notifications
You must be signed in to change notification settings - Fork 421
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
error handling: returning errors from writeThis #7261
Comments
Enable strict error handling by default for modules Continuing PR #7244, this PR turns on strict error handling for more code and adjusts the modules and tests appropriately to match. This PR adjusts several `writeThis` methods to use `<~>` instead of `channel.write` since the operator saves an error code in the channel instead of throwing. This is a workaround for the problem discussed in issue #7261. This PR follows on earlier work in which the top-level `proc writeln` and associated routines (`write`, `writef`) do not throw. The idea is that they appear frequently enough & a program would be messed up enough if they didn't work that it should be a fatal error. In contrast, the methods on channels, such as `proc channel.writeln()` *do* throw since it's possible to encounter errors when doing file or network I/O. Along the same lines, we considered possibly making `string.format()` not throw, but there is really only one name for this routine, and it's definitely less common than `writeln`. - [x] full local testing Reviewed by @psahabu - thanks!
Continuation/bug-fix of chapel-lang#7245. That PR adjusted several `writeThis` methods to use `<~>` instead of `channel.write` since the operator saves an error code in the channel instead of throwing. This was a workaround for the problem discussed in issue chapel-lang#7261. This makes the same change for network atomics, which was missed in that PR.
Fix writeThis in network atomics module Continuation/bug-fix of #7245. That PR adjusted several `writeThis` methods to use `<~>` instead of `channel.write` since the operator saves an error code in the channel instead of throwing. This was a workaround for the problem discussed in issue #7261. This makes the same change for network atomics, which was missed in that PR.
Fix error handling compiler errors from nightly testing Fixes error-handling related compilation errors from nightly testing and applies the `<~>` workaround for the problem described in #7261 in more places in module code and in test code we might like to be module code soon. Trivial and not reviewed. - [x] verified that test/modules/packages/blas passes - [x] verified that fifo deadlock detection/report works again - [x] test/distributions with quickstart - [x] test/distributions/robust/arithmetic/trivial/test_writeln with default, block, cyclic, replicated - [x] full local testing
Just ran into this again (because I keep forgetting). Tried to do the equivalent of |
This is the status quo today and I haven't internalized the implications until now. Using the |
It's possible to clear the error. Also I'm not sure I'd call it "silently failing". It's just within a In other words, the current status quo puts off handling the error until the outmost |
@dlongnecke-cray - is this one done now? |
Resolved by merge of #14739. |
The
writeThis
,readWriteThis
, andreadThis
methods can be provided on a type to implement how that type is written or read.As part of the error handling effort for Chapel 1.16, many I/O functions now are marked
throws
. Some of these might be called by the above methods likewriteThis
.Currently, if there is an error performing I/O in support of
writeThis
/..., an error code is saved in the relevant channel. Then, subsequent attempts to do I/O on that channel as part ofwriteThis
will instead do nothing and preserve the error.This method of saving an error code in the channel doesn't fit with the
throws
style errors that we'd like to be able to use, however. In particular, one might imagine wanting to have awriteThis
/... that can throw an arbitrary user error.At the time of this writing,
channel.writef
orchannel.write
are markedthrows
, but the I/O operator<~>
is not. Instead, the I/O operator always saves the "error" state in to the channel. For this reason, PR #7245 changes several calls towrite
to calls to<~>
as a workaround for this issue. Longer term though, I think we want<~>
to be equivalent tochannel.write
.We could:
The text was updated successfully, but these errors were encountered: