fix(api, shared-data, robot-server): stringify all error info in run log #13942
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The
GET /runs
endpoint was returning a 500 error in some cases as a result of invalid entries in the robot run log. In the specific case of RQA-1872, the cause is a non-string entry in theerrorInfo
dictionary for an error that failed a run. To get more specific, the issue was that the PipetteOverpressureError exception was being created with an info field with a value field that was an instance ofOT3Mount
.Before this PR, our enumerated errors would accept a dictionary with string keys and any value type. This PR changes the classes to force the dictionary values to be strings. The
ErrorOccurrence
constructor was not performing any validation on its inputs because it was using theconstruct
method, and now it doesn't have to worry about that because any exceptions have to use strings.In addition, this PR adds a catch for
ValidationErrors
when getting the State Summary from the Run Store. It will return None, which is already tolerated by the higher calling functions in theGET /runs
chain.Test Plan
Fail a run with an overpressure error on a robot with current
edge
, then push this branch, and then make sureGET /runs
doesn't return a 500 error (there should be an empty state summary for the run that failed).Changelog
Review requests
Risk assessment
Pretty low, touches error handling that was already broken and stringifies a bunch of error messages.