RMLio / rmlmapper-java

The RMLMapper executes RML rules to generate high quality Linked Data from multiple originally (semi-)structured data sources
http://rml.io
MIT License
146 stars 61 forks source link

Not very helpful error messages #167

Open danmichaelo opened 2 years ago

danmichaelo commented 2 years ago

I know that producing good error messages is hard, but the information in the error messages from this tool is often not enough to locate which mapping caused the error in a large mapping set. Here's an example:

10:42:04.062 [main] ERROR be.ugent.rml.cli.Main               .main(393) - For input string: "1533887350415"

There's no information about what kind of error it is or which source/column it was pulled from.

I'm not familiar with Java, but I tried adding a stack trace print (most likely not the most elegant way to do so :D):

StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
logger.error(stackTrace);

It revealed one additional piece of useful information, that the error was caused by converting a large number to int:

10:43:56.326 [main] ERROR be.ugent.rml.cli.Main               .main(401) - java.lang.NumberFormatException: For input string: "1533887350415"
    at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
    at java.base/java.lang.Integer.parseInt(Integer.java:668)
    at java.base/java.lang.Integer.parseInt(Integer.java:784)
    at be.ugent.rml.Utils.transformDatatypeString(Utils.java:595)
    at be.ugent.rml.termgenerator.LiteralGenerator.lambda$generate$0(LiteralGenerator.java:87)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at be.ugent.rml.termgenerator.LiteralGenerator.generate(LiteralGenerator.java:63)
    at be.ugent.rml.Executor.generatePredicateObjectGraphs(Executor.java:277)
    at be.ugent.rml.Executor.executeWithFunctionV5(Executor.java:233)
    at be.ugent.rml.Executor.executeV5(Executor.java:152)
    at be.ugent.rml.cli.Main.main(Main.java:371)
    at be.ugent.rml.cli.Main.main(Main.java:45)

Should stack traces be printed by default? Perhaps? Or perhaps just the first part? If possible, it would also be awesome if the error could include information about which source/column caused the error.

DylanVanAssche commented 2 years ago

Thanks for reporting this! It is indeed on our radar to improve the error messages, but as you mentioned it is hard.