Skip to content

Commit

Permalink
fix(app,robot-server): Display less error barf (#13495)
Browse files Browse the repository at this point in the history
* Omit errorInfo.

* Flesh out ErrorOccurrence documentation.
  • Loading branch information
SyntaxColoring authored Sep 12, 2023
1 parent a1cde96 commit 4f87ee2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 16 deletions.
46 changes: 42 additions & 4 deletions api/src/opentrons/protocol_engine/errors/error_occurrence.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,55 @@ def from_failed(
)

id: str = Field(..., description="Unique identifier of this error occurrence.")
errorType: str = Field(..., description="Specific error type that occurred.")
createdAt: datetime = Field(..., description="When the error occurred.")
detail: str = Field(..., description="A human-readable message about the error.")

errorCode: str = Field(
default=ErrorCodes.GENERAL_ERROR.value.code,
description="An enumerated error code for the error type.",
description=(
"An enumerated error code for the error type."
" This is intended to be shown to the robot operator to direct them to the"
" correct rough area for troubleshooting."
),
)

# TODO(mm, 2023-09-07):
# The Opentrons App and Flex ODD use `errorType` in the title of error modals, but it's unclear
# if they should. Is this field redundant now that we have `errorCode` and `detail`?
#
# In practice, this is often the source code name of our Python exception type.
# Should we derive this from `errorCode` instead? Like how HTTP code 404 is always "not found."
errorType: str = Field(
...,
description=(
"A short name for the error type that occurred, like `PipetteOverpressure`."
" This can be a bit more specific than `errorCode`."
),
)

detail: str = Field(
...,
description=(
"A short human-readable message about the error."
"\n\n"
"This is intended to provide the robot operator with more specific details than"
" `errorCode` alone. It should be no longer than a couple of sentences,"
" and it should not contain internal newlines or indentation."
"\n\n"
" It should not internally repeat `errorCode`, but it may internally repeat `errorType`"
" if it helps the message make sense when it's displayed in its own separate block."
),
)

errorInfo: Dict[str, str] = Field(
default={},
description="Specific details about the error that may be useful for determining cause.",
description=(
"Specific details about the error that may be useful for determining cause."
" This might contain the same information as `detail`, but in a more structured form."
" It might also contain additional information that was too verbose or technical"
" to put in `detail`."
),
)

wrappedErrors: List["ErrorOccurrence"] = Field(
default=[], description="Errors that may have caused this one."
)
Expand Down
6 changes: 0 additions & 6 deletions app/src/organisms/Devices/ProtocolRun/RunFailedModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react'
import isEmpty from 'lodash/isEmpty'
import { useTranslation } from 'react-i18next'
import {
ALIGN_CENTER,
Expand Down Expand Up @@ -95,11 +94,6 @@ export function RunFailedModal({
<StyledText as="p" textAlign={TYPOGRAPHY.textAlignLeft}>
{highestPriorityError.detail}
</StyledText>
{!isEmpty(highestPriorityError.errorInfo) && (
<StyledText as="p" textAlign={TYPOGRAPHY.textAlignLeft}>
{JSON.stringify(highestPriorityError.errorInfo)}
</StyledText>
)}
</Flex>
<StyledText as="p">
{t('run_failed_modal_description_desktop')}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { useHistory } from 'react-router-dom'
import isEmpty from 'lodash/isEmpty'
import { css } from 'styled-components'

import {
Expand Down Expand Up @@ -98,11 +97,6 @@ export function RunFailedModal({
<StyledText as="p" textAlign={TYPOGRAPHY.textAlignLeft}>
{highestPriorityError.detail}
</StyledText>
{!isEmpty(highestPriorityError.errorInfo) && (
<StyledText as="p" textAlign={TYPOGRAPHY.textAlignLeft}>
{JSON.stringify(highestPriorityError.errorInfo)}
</StyledText>
)}
</Flex>
</Flex>
<StyledText as="p" textAlign={TYPOGRAPHY.textAlignLeft}>
Expand Down

0 comments on commit 4f87ee2

Please sign in to comment.