Initially this will be scoped to just the hearings codebase so that it can be expanded upon in other parts of the codebase in the future. We can begin by determining the current structure of errors and agreeing on a single structure to be applied. The next step could be creating a new component to handle the updated error structure. When the component is in place, we can then begin going through screens/controllers individually and updating the existing handling of errors to use the new component and structure.
Outlined below is a list of the controllers and frontend components involved with sending/displaying errors to the user.
The components below are grouped by the current hearings screens in order to better understand the flow of errors within the frontend and show why different components might be used for different screens based on the types of errors being handled.
Current Structure
All of the hearings frontend components that are not shared with other Caseflow apps reside in: client/app/hearings
. The entry point for the Hearings app is: client/app/hearings/HearingsApp.jsx
. This component contains the browser router and all of the screens within Hearings. Below are the current list of screens:
HearingWorksheetPrintAllContainer: /hearings/worksheet/print
type/title/messageText
DailyDocketContainer:
Routes
/hearings/docket/:hearingDayId/print
/hearings/schedule/docket/:hearingDayId
State
serverError
HANDLE_DAILY_DOCKET_SERVER_ERROR
actiondailyDocketServerError
(redux)
HANDLE_DAILY_DOCKET_SERVER_ERROR
actiononErrorHearingDayLock
(redux)
HANDLE_LOCK_HEARING_SERVER_ERROR
actionComponents
client/app/components/Alert.jsx
message
or children
title
type
one of success
, error
, warning
, or info
UserAlerts client/app/components/UserAlerts.jsx
Props
alerts
Components
client/app/components/Alert.jsx
Alert client/app/components/Alert.jsx
DispositionModal
RemoveHearingModal
LockModal
DailyDocketEditLinks
DailyDocketHearingRows
State
alerts
RECEIVE_TRANSITIONING_ALERT
, TRANSITION_ALERT
, REMOVE_ALERTS_WITH_EXPIRATION
, CLEAR_ALERTS
, or RECEIVE_ALERTS
client/app/components/common/reducers.js
transitioningAlerts
RECEIVE_TRANSITIONING_ALERT
or TRANSITION_ALERT
client/app/components/common/reducers.js
Components
HearingText client/app/hearings/components/dailyDocket/DailyDocketRowDisplayText.jsx
client/app/hearings/components/dailyDocket/DailyDocketRowInputs.jsx
client/app/queue/PowerOfAttorneyDetail.jsx
client/app/hearings/components/HearingTime.jsx
HearingTime client/app/hearings/components/modalForms/HearingTime.jsx
errorMessage
string is set by props, however does not appear to be set by the DailyDocketRow
VirtualHearingModal
State
representativeEmailError
onSubmit
INVALID_EMAIL_FORMAT
constantappellantEmailError
setAppellantEmailError
in validateForm
and in the catch block of onSubmit
INVALID_EMAIL_FORMAT
constantAodModal
client/app/hearings/components/dailyDocket/DailyDocketRowInputs.jsx
StatusMessage
title
set by COPY.HEARING_SCHEDULE_DOCKET_JUDGE_WITH_NO_HEARINGS
or COPY.HEARING_SCHEDULE_DOCKET_NO_VETERANS
errorMessage
string set by props, not used in HearingDayEditModal
errorMessage
string set by props, not used in HearingDayEditModal
errorMessage
string set by props, not used in HearingDayEditModal
HearingsUserContext: /hearings/:hearingId/details
LoadingDataDisplay
HearingsFormContextProvider
HearingDetails
submit
error.message
instead of error.detail
State
virtualHearingErrors
submit function
checks and catch blockerrors
object in lower componentserror
resetState
submit
function catch blockComponents
client/app/components/UserAlerts.jsx
client/app/components/Alert.jsx
onSubmit
error.message
instead of error.detail
representativeEmailError
onSubmit
INVALID_EMAIL_FORMAT
constantappellantEmailError
setAppellantEmailError
in validateForm
and in the catch block of onSubmit
INVALID_EMAIL_FORMAT
constantHearingWorksheetContainer: /hearings/:hearingId/worksheet
NOTE: Did not find any errors outside of local errors
client/app/hearings/components/hearingWorksheet/WorksheetHeader.jsx
client/app/hearings/components/hearingWorksheet/WorksheetHeader.jsx
client/app/hearings/components/hearingWorksheet/WorksheetHeader.jsx
ListScheduleContainer: /hearings/schedule
State
serverError
Components
errorType
, queryResultingInError
, and errorMessage
set by caseList.search
redux stateinvalidDates
key through props from hearingSchedule
redux state)errorMessages
onClickConfirm
roErrorMessages
onClickConfirm
dateError
onClickConfirm
, resetErrorState
errorMessages
local variabletypeError
onClickConfirm
, resetErrorState
errorMessages
local variableroError
onClickConfirm
, resetErrorState
roErrorMessages
local variableserverError
persistHearingDay
noRoomsAvailableError
persistHearingDay
error.detail
instead of error.details
Components
serverError
and noRoomsAvailableError
)errorMessage
received through propsBuildScheduleContainer: /hearings/schedule/build
BuildScheduleUploadContainer: /hearings/schedule/build/upload
State
createSchedulePeriod
validateData
uploadFormErrors
hearingSchedule
redux stateuploadRoCoFormErrors
hearingSchedule
redux stateuploadJudgeFormErrors
hearingSchedule
redux stateComponents
uploadJudgeFormErrors
, uploadRoCoFormErrors
uploadFormErrors
set on RadioField componentReviewAssignmentsContainer: /hearings/schedule/build/upload/:schedulePeriodId
State
schedulePeriodError
schedulePeriodError
spErrorDetails
spErrorDetails
error.details
instead of error.detail
Components
AssignHearingsContainer: /hearings/schedule/assign
NoUpcomingHearingDayMessage
AssignHearingsTabs
showNoVeteransToAssignError
onPageLoaded
Components
The controllers below each contain some response with a defined error structure. They can be grouped based on how the error is currently being constructed and sent to the frontend.
Current Structure
app/controllers/hearings_controller.rb
ActiveRecord::RecordNotFound
(errors
[message
, code
])ActiveRecord::RecordNotUnique
(errors
[message
, code
])ActiveRecord::RecordInvalid
(errors
[message
, code
])Caseflow::Error::VacolsRepositoryError
(errors
[message
, code
])ExternalApi::VADotGovService
, serialized in Caseflow::Error
Caseflow::Error::VaDotGovMissingFacilityError
(errors
[{ status
, title
, detail
}])ExternalApi::VADotGovService::Response
, serialized in Caseflow::Error
Caseflow::Error::VaDotGovLimitError
(errors
[{ status
, title
, detail
}])Caseflow::Error::VaDotGovRequestError
(errors
[{ status
, title
, detail
}])Caseflow::Error::VaDotGovServerError
(errors
[{ status
, title
, detail
}])app/controllers/hearings/schedule_hearing_tasks_columns_controller.rb
Caseflow::Error::InvalidParameter
(parameter
, message
)app/controllers/hearings/schedule_periods_controller.rb
HearingSchedule::Errors::NotEnoughAvailableDays
(error
, details
, type
)HearingSchedule::Errors::CannotAssignJudges
(error
, details
, type
)ActiveRecord::RecordInvalid
(error
)error
)app/controllers/hearings/hearing_day_controller.rb
ActiveRecord::RecordInvalid
(errors
: [title
, detail
])errors
: [title
, detail
, status
])errors
: [title
, details
])