Added try-catch for column access with a detailed error messages#1873
Added try-catch for column access with a detailed error messages#1873AndreiKingsley wants to merge 6 commits into
Conversation
…ith detailed messages
| $columnAccessCode | ||
| } catch (e: kotlin.Exception) { | ||
| val msg = when (e) { | ||
| is kotlin.IllegalArgumentException -> "Column not found exception in the generated DataFrame extension property '$renderedColumnName': " + e.getLocalizedMessage() + ". See $troubleshootingLink for more information." |
There was a problem hiding this comment.
Is there a reason you mix string templates and + here, actually? Just curious :)
There was a problem hiding this comment.
For me just better readability. But let's be consistent and idiomatic, ok.
There was a problem hiding this comment.
you can also use a string builder if that looks more readable :)
There was a problem hiding this comment.
I rewrote with better templates!
|
you've got some failing tests :) |
|
@Jolanrensen this PR is not supposed to me merged (most probably) — @koperagen doesn't want to change EP logic on library side, but I need you review on it because it's much easier to review it here rather then in Compiler Plugin. |
| */ | ||
| private fun generateTryCatchColumnAccess(columnAccessCode: String, columnName: String): String { | ||
| val renderedColumnName = renderStringLiteral(columnName) | ||
| return $$""" |
There was a problem hiding this comment.
nice $$ usage :) but can you indent the code a bit further to the right? It's currently left of the return. Also if you assign it to a variable first, you can annotate it with @Language("kotlin") which might be nice
Library codegen implementation of #1742.
I want to add the same codegen to Compiler Plugin.
Can be improved with #1871 and #1872, but for now I added simple different exception handling
error.Requires new doc page from #1870.