Generate clearer exception for Avro schema translation failures#1021
Generate clearer exception for Avro schema translation failures#1021clairemcginty wants to merge 3 commits intomasterfrom
Conversation
| } catch (Exception e) { | ||
| throw new RuntimeException(String.format( | ||
| "Failed to build Avro schema for sqlType %d %s [%s, %s]", | ||
| columnType, typeName, columnClassName, columnTypeName | ||
| ), e); | ||
| } |
There was a problem hiding this comment.
I don't mind the idea. I think in the new version of dbeam though the exceptions won't be as bad, but wrapping the code and reporting which field had an issue could still be useful anyways. Maybe it would look cleaner with a new helper function such as convertField(), then in createAvroFields() in the loop, we call convertField() on each field and that is wrapped in try-catch block.
There was a problem hiding this comment.
nice idea! will do
There was a problem hiding this comment.
ugh, tried out the helper function and i think it was overall messier because there's like 5 variables we need to pass in per field, and extra 2 containing state from the outer loop. might be more trouble than it's worth :(
There was a problem hiding this comment.
ok fair enough, I'm fine with just wrapping the whole code block in try-catch then
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1021 +/- ##
============================================
+ Coverage 91.92% 91.96% +0.03%
Complexity 283 283
============================================
Files 27 27
Lines 1015 1020 +5
Branches 86 86
============================================
+ Hits 933 938 +5
Misses 54 54
Partials 28 28 🚀 New features to boost your workflow:
|
No description provided.