Repository navigation
feat(cubesql): Universally prefix all errors - #10758
Conversation
|
Claude finished @MazterQyou's task in 6m 3s —— View job Code Review: Universally prefix all errors
SummaryThis is a well-structured PR that introduces a systematic error taxonomy across CubeSQL. The core idea — replacing the old 2-variant What works well
Issues & suggestionsMedium priority:
Low priority / nits:
TestingThe test changes look correct:
SecurityNo security concerns. The OverallSolid improvement to error handling infrastructure. The error taxonomy is well-thought-out and the conversion pipelines are correct. The main risk area is ensuring downstream consumers (logs, HTTP responses, PG wire protocol) get the right level of detail — the inline comments highlight the specific spots to verify. |
| CompilationError::User(right, _) => left == right, | ||
| _ => false, | ||
| }, | ||
| CompilationError::RESTAPI(left, _) => match other { | ||
| CompilationError::RESTAPI(right, _) => left == right, | ||
| _ => false, | ||
| }, | ||
| CompilationError::SQLParser(left, _) => match other { | ||
| CompilationError::SQLParser(right, _) => left == right, | ||
| _ => false, | ||
| }, | ||
| CompilationError::Unsupported(left, _) => match other { | ||
| CompilationError::Unsupported(right, _) => left == right, | ||
| _ => false, | ||
| }, | ||
| CompilationError::Planning(left, _) => match other { | ||
| CompilationError::Planning(right, _) => left == right, | ||
| _ => false, | ||
| }, | ||
| CompilationError::PostProcessing(left, _) => match other { | ||
| CompilationError::PostProcessing(right, _) => left == right, | ||
| _ => false, | ||
| }, | ||
| CompilationError::Rewrite(left, _) => match other { | ||
| CompilationError::Rewrite(right, _) => left == right, | ||
| _ => false, | ||
| }, | ||
| CompilationError::DatabaseExecution(left, _) => match other { | ||
| CompilationError::DatabaseExecution(right, _) => left == right, | ||
| _ => false, | ||
| }, | ||
| CompilationError::Fatal(left, _) => match other { | ||
| CompilationError::Fatal(right, _) => left == right, | ||
| _ => false, | ||
| }, | ||
| CompilationError::ContinueWait => matches!(other, CompilationError::ContinueWait), | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
Suggestion: consider a macro or helper for PartialEq — This block is very repetitive. Each new variant adds 3 lines of identical structure. A macro like:
macro_rules! match_variant_eq {
($self:expr, $other:expr, $($Variant:ident),+) => {
match ($self, $other) {
$( (CompilationError::$Variant(left, ..), CompilationError::$Variant(right, ..)) => left == right, )+
(CompilationError::ContinueWait, CompilationError::ContinueWait) => true,
_ => false,
}
}
}could reduce this significantly. Same applies to to_backtrace(), to_backtrace_mut(), message(), with_message(), and with_meta(). Not blocking — just noting that the boilerplate will grow linearly with each new error variant.
ffc162c to
4eec296
Compare
4eec296 to
926c03e
Compare
926c03e to
b790e17
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #10758 +/- ##
==========================================
- Coverage 78.93% 78.82% -0.12%
==========================================
Files 470 470
Lines 92868 93066 +198
Branches 3450 3450
==========================================
+ Hits 73307 73356 +49
- Misses 19056 19205 +149
Partials 505 505
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b790e17 to
b8c91d1
Compare
Signed-off-by: Alex Qyoun-ae <4062971+MazterQyou@users.noreply.github.com>
b8c91d1 to
f9b2ec4
Compare
Check List
Description of Changes Made
This PR makes an effort to universally prefix all errors with preset messages, and unwrap error onions wherever possible.