bcgov / bcgov/wps

Add error handling around WFWX API

Open
#1,080 0 comments 0 reactions 0 assignees View on GitHub
4Refinement Task
Dominant language
Python
Stars
65
Forks
11
Avg merge
21h 25m
Merged PRs (30d)
70

Description

**Describe the task**
We should add better error handling for errors received from the WFWX API. When our client experiences a failure because of a WFWX error, we only get an error logged in our API - there's no frontend indication of what's happened, so the failure tends to be silent and confusing.

Since WFWX is external, we have no control over when/how it breaks, but we can at least have a clearer delineation (for troubleshooting purposes) of when an error occurs because of us or because of WFWX.

IMO this ticket is worthy of more discussion amongst the devs to determine the specifics of how we should handle WFWX errors.

**Acceptance Criteria**
- [ ] Display generic error message to indicate to user that a network request has failed
- [ ] Error message should indicate which endpoint is problematic (e.g., `/forecasts/noon/`)

**Additional context**
- A 504 gateway timeout message from WFWX looks like this:
```

101504
Status report
Runtime Error
Send timeout

```
We don't currently display anything in our FE to indicate this error has been encountered. Our API logs an error about unexpected mimetype (because we expect WFWX's response to be in JSON, which is only the case when the request returns successfully).
- Implementation of this ticket is dependent on Tess to mock up the look of the error and the wording of the error message

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. First resolve the frontend mockup, wording, and handling design with the developers, then trace the WFWX request path and its frontend error display. Done means failed WFWX requests show a generic network error and identify the problematic endpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python, react
Domain
api, backend, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.