feat(prepro): ensure all internal errors are properly logged and include proper information#6801
Conversation
…ude proper information
|
This PR may be related to: #2040 (Fail silo-preprocessing container when command fails so we notice errors) |
|
Claude finished @anna-parker's task in 2m 41s —— View job Code Review
Overall this is a clean, well-scoped refactor. The Two things to look at:
Test updates look correct — the new assertions match the updated error message format. |
|
@claude review |
|
Claude finished @anna-parker's task in 1m 51s —— View job Code Review
OverallGood cleanup. The Findings1. Awkward In # ~line 728
errors.extend(
raw_internal_error(
f"dateRangeString field '{order[i]}' has an unexpected format: ..."
).errors
)
# ~line 773
errors=errors + raw_internal_error(
f"Concatenation failed for '{output_field}' with error: {e} ..."
).errors,This works correctly (the A cleaner alternative would be to extract a tiny private helper: def _internal_error_message(message: str) -> str:
full = f"Internal Error. {message} Please contact the administrator."
logger.error(full)
return full
def raw_internal_error(message: str) -> RawProcessingResult:
return processing_error(_internal_error_message(message))Then the errors.append(_internal_error_message(f"dateRangeString field ..."))Not a blocker, but worth considering. Fix this → 2. At ~line 726, when the date string has too many 3. The old code lost any errors accumulated before the errors=errors + raw_internal_error(...).errors,Good. 4. The general function-dispatch handler at ~line 335 still calls 5. Test assertion is now tighter — good # before
assert "Was unable to process phenotype values" in invalid.errors[0].message
# after
assert "Internal Error. Phenotype value processing failed: invalid syntax" in invalid.errors[0].messageThe tighter assertion catches regressions in the message format. The other test file change is just adding a type annotation. SummaryNo blocking issues. The main suggestion is the |
Co-authored-by: maverbiest <59956362+maverbiest@users.noreply.github.com>
5f649af
into
copilot/refactor-error-warnings-verbosity
…lude proper information
Follow up to #6537 - ensure that all internal errors thrown by prepro (these are related to invalid config, unexpected nextclade format etc.) are properly annotated with the prefix "Internal Error:" and the suffix "Please contact the administrator."
Screenshot
PR Checklist
🚀 Preview: Add
previewlabel to enable