Error handler revamp#647
Conversation
| case INVALID_EXPTIME: | ||
| e.runtime.message = "Invalid exposure time."; |
There was a problem hiding this comment.
Oh, I forgot I made this one up because the message didn't exist. Is this fine, or should it be something else?
There was a problem hiding this comment.
Please see my comment for do2d.c Line 414. Either (1) the definition of this case, INVALID_EXPTIME, has to change because the places it was used previously (code 1001?) may not mean what you thought they meant, or (2) use a different code at the error locations.
b20e366 to
b6d78e2
Compare
c260529 to
60dfabf
Compare
60dfabf to
c913211
Compare
| if (hstio_err()) { | ||
| trlerror("Couldn't write imset %d.", extver); | ||
| return (status = 1001); | ||
| return (status = INVALID_EXPTIME); |
There was a problem hiding this comment.
EXPSCORR indicates each individual exposure from a CR-SPLIT, repeated sub-exposures, or DITHER observation should generate an FLT/FLC file. In other words the "exps" is misleading in that it does not indicate exposure time, but rather individual exposure calibration (to FLT/FLC). A failure here indicates "WRITE_FAILED". Or at least this is close to what is happening, but it is still not clear why.
|
Lots of conflicts now. If you are still interested in pursuing this, please rebase. Otherwise, please close the PR without merge. Thanks! |
f130e64 to
a2ed2b7
Compare
* Remove redundant local prototypes * Remove whicherror.c(s)
* Provides a replacement for WhichError * Statuses in the code that do have an error message associated with them are recorded as UNKNOWN_MAGIC_CODE_nnnn and result in "Unknown error." at runtime
adefbb2 to
3e4e1fb
Compare
All instrument packages provide their own error reporting routine (
pkg/[inst]/whicherror.c:WhichError) however the code is effectively the same wherever it appears. The only exception is that whenstatuswas to set toACS_OK,WFC3_OK, orSTIS_OK(all three are defined as0) the function returns early.This PR breaks the error reporting function into two:
hstcal_error_state_populate- responsible for initializing ahstcal_error_statestructurehstcal_error_state_show- responsible for displaying error information, similar toWhichError.And introduces two macros:
REPORT_ERROR_STATE()- Effectively replacesWhichError, and does not require any argumentsWhichError()- Is a wrapper. The argument normally accepted by the oldWhichErroris ignored, but allows the existing hstcal to work as-is.The
hstcal_error_statestructure just keeps all of HSTCAL's errors in one convenient place.No additional memory is allocated by these functions, so they can be called from anywhere without fear of accidentally introducing leaks. To keep things clean and simple the backtrace feature writes directly to the
stderrdescriptor to avoid callingmallocif/when we're already out of RAM.Example error (with
-DENABLE_BACKTRACE=ON):Example error (with
-DENABLE_BACKTRACE=OFF(default)):And in mainacs:238 we see the following:
This
DEBUGmessage is only visible whenNDEBUGis not defined, so this follows the same behavioral pattern as all theassertstatements in the code.Magic numbers have been mapped to the appropriate
#define. For anystatusvalues that don't map back to a define, I createdUNKNOWN_MAGIC_CODE_nnnndefines, and placeholder messages for each. These need to be investigated to see what errors actually need to be emitted.Fix #187