-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: add friendly message mapping #3079
Conversation
f02a3fb
to
934f6e6
Compare
for (const key of Object.keys(reportValidationMessagesMap)) { | ||
if (errorStr.includes(key)) { | ||
return key as ReportValidationMessageKey; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will just introduce some potential weirdness, if we don't explicitely define where the keys we're trying to catch come from. I think we should at the very least make sure that our ReportActivityService
throws errors with the right key, that we can then match here. A lot of error messages might contain "emission"!
ReportSubmissionService
raises specific exception messages to be caught on the frontend, and we'd want to do the same, as an example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank-you and in agreement that your ReportSubmissionService errors are a good pattern to follow...
In this particular case my choice was specifically not to make any changes to the ReportActivitySaveService
(to avoid possible regression bugs etc.) but, still provide a nicer message to the user than the service generated errors: fuelName
; gasType
; emission
.
I have refined the utils function for your re-consideration - thanks!
934f6e6
to
eb831af
Compare
eb831af
to
ba8d9e9
Compare
Hey @shon-button as part of the new error messages, is it doable for the Activities pages back end error messages be renamed to "< field name > is required" so it is uses plain language? i.e., "Emission 1's Fuel name is required" "Emission 1's methodology is required" |
7a8dc50
to
c286ae7
Compare
@zoeyli-46 Hi Zoey, I will put the related issue card back in the backlog with |
Note: re-opening for further consideration of merging based on...
|
3dcb7c0
to
ca2b60e
Compare
ca2b60e
to
7217bed
Compare
chore: prettier chore: cleanup chore: cleanup chore: cleanup chore: cleanup
83c9fc4
to
cf729c4
Compare
Addresses: 634
🚀 Impact:
emission
;fuelName
;sgasType
into user friendly message.🔬 Local Testing:
Tests Set-Up:
Start the API server:
cd bc_obps make reset_db make run
Start the app development server:
Navigate to http://localhost:3000
Click the "Log in with Business BCeID" button
Log in using
bc-cas-dev
Test: User friendly error messages
Steps
Bugle SFO - Registered
Continue
General stationary combustion excluding line tracing\General stationary combustion of fuel or waste with production of useful energy
Save and Continue
Expected Result
✅

Error displays: "Fuel is expecting 'Fuel Name' data." (transformed back-end error message)
Fuel Name
Save and Continue
Expected Result
✅

Error displays: "Emission is expecting 'Gas Type' data." (transformed back-end error message)
Gas Type
Save and Continue
Expected Result
✅

Error displays: "Emission is expecting 'Emission' data." (transformed back-end error message)
Emission
Save and Continue
Expected Result
✅

Error displays: "Emission is expecting methodology data" (direct back-end error message)
sign-off
, ex: http://localhost:3000/reporting/reports/1/sign-offSubmit report
Expected Result
✅

Error displays: Verification information must be completed with this report. Please complete the Verification page.
verification
, ex: http://localhost:3000/reporting/reports/1/verificationSave and Continue
sign-off
, ex: http://localhost:3000/reporting/reports/1/sign-offSubmit report
Expected Result
✅

Error displays: A verification statement must be uploaded with this report. Please upload a verification statement on the Attachments page.