Open ashfaq-shaik opened 2 years ago
Thanks for raising this. This looks like an error in the logs though. Ideally you should look at errors in the client. Since 1.18.x these errors will be reported in a cleaner way and flow through the JSON API to the client (almost) untouched.
@S11001001 is there already something done as part of the recent work in error reporting that improves the readability of errors coming from the ledger (I'd guess probably not for this instance in particular, as the work your recently did was around reporting errors from the ledger verbatim). Is there something coming along with self-service error codes that could possibly help here or would something like this need be addressed separately?
/cc @cocreature to have your thoughts on the engine error reporting, not sure if there's some change needed there as well.
This is a log excerpt from JSON API. I interface with the ledger using JSON API. Could you clarify what you mean by client?
In my context I have "Application" ----Connecting----> "JSON API" ------Talking to------> "VMBC LEDGER"
/cc @cocreature to have your thoughts on the engine error reporting, not sure if there's some change needed there as well.
The engine reports errors as structured scala types which I believe are mapped to structural errors by the ledger API server and then that error turns into a JSON API exception which is what triggers the stacktrace.
Is there something coming along with self-service error codes that could possibly help here or would something like this need be addressed separately?
details
structure that it receives from ledger API on receiving StatusRuntimeException
, as part of the self-service error codes changes.That will help to the degree that this structure gives...structure to an error such as Command interpretation error in LF-DAMLe: Interpretation error: Error...
. To the degree that it does not, it will not make a difference, and I don't think JSON API should get in the business of "parsing" and reformatting these errors.
/cc @cocreature to have your thoughts on the engine error reporting, not sure if there's some change needed there as well.
The engine reports errors as structured scala types which I believe are mapped to structural errors by the ledger API server and then that error turns into a JSON API exception which is what triggers the stacktrace.
@cocreature At which point is the error turned into a string instead of exposing the full structure of the partial transaction? If the JSON API receives a string, I agree with @S11001001 that it doesn't make sense to parse it.
I think it’s in https://github.com/digital-asset/daml/blob/08236012af6348057ec27c43815e6809766c784b/ledger/participant-integration-api/src/main/scala/platform/apiserver/services/ApiSubmissionService.scala#L312. ErrorCause
is the engine error type and then the ledger API server calls explain
to turn that into a string.
@gerolf-da Your thoughts on the possibility of letting the Daml Engine error structure through instead of turning it into a string?
EDIT: looking at the comment, it looks like this is part of the scope for self-service error codes.
Putting the transaction structure in a structured way into the error message is likely not going to work, because the error protocol has a size limit of the error. so we'll likely end up having to truncate the error message, which doesn't make sense for a large structure. See also google's documentation.
Putting the transaction structure in a structured way into the error message is likely not going to work, because the error protocol has a size limit of the error. so we'll likely end up having to truncate the error message, which doesn't make sense for a large structure. See also google's documentation.
Wouldn't this be true regardless of whether we expose the error in a structured way or as a string?
In its current form. JSON API / DAML Runtime reports its error/stack trace as a continuous string, that is not readable. Example in the end.
For anyone who is troubleshooting, this imposes various challenges in terms of readability and accuracy of problem context, because if a parenthesis is missed while reading, the definition/hierarchy changes.
From a personal note. I am dyslexic, and it's a nightmare for me to understand the error and trace. With a pen and paper, I have to spend a good 10-15 min to read through, and in time-sensitive situations where there is an error in production environment, this challenge quadruples.
Is there a way to print/report the stack trace in a readable format? Similar to how Java/Javascript prints it.