Fixed
Details
Details
Assignee
Pothys - MitrahSoft
Pothys - MitrahSoftReporter
Zac Spitzer
Zac SpitzerNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Sprint
None
Fix versions
Priority
Created 10 October 2022 at 11:05
Updated 20 June 2024 at 20:16
Resolved 9 June 2023 at 10:59
When a json deserializing error occurs, the error message is rather confusing
https://trycf.com/gist/92ed093b8d46ff052b27929eb479930b/lucee5?theme=monokai
when the source text is longer than 1024 characters, only the first snippet 1024 characters are shown, the cfml object includes the position in the string, so the error message snippet sometimes doesn’t even include the actual problematic content.
as actual error includes the character position, provide better contextual feedback (i.e. offset and snippet)
i.e. Syntax Error, invalid expression [7D]
also when a sub snippet is provided, indication that it’s sub snippet ,
...]
would be quite informative<cfscript> x = '{ content: "#repeatString('a ',505)#" }7D'; </cfscript> <cfscript> try { j = ""; j = deserializeJson(x); } catch (e) { echo(e); } dump(j); </cfscript>
this screenshot shows with 495 repeated strings, rather than 505, so the preview of the source string fits in the screenshot
https://github.com/lucee/Lucee/blob/5.3/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L215