bcgov / bcgov/entity

Business API: improve handling of some schema errors

Open
#32,599 4 comments 0 reactions 0 assignees View on GitHub
bug Entities Team
Dominant language
JavaScript
Stars
23
Forks
62
Avg merge
24m
Merged PRs (30d)
1

Description

In general, schema errors are handled by the API so that the response to the UI is meaningful (eg, contains a useful error message and error path). Eg,

image.png

However, some schema errors are improperly handled and do not provide the UI with the expected response. Eg,

image.png

(The above was simulated by filing an IA missing the contactPoint object.)

Here is the network response. The UI expects errors[0].error to be the message presently stored in errors[0].context[0].message. I also question why the context object is provided at all.

image.png

Vysakh looked at the code with me and is unsure why the response is as above -- it would take more digging and that's why I created this ticket.

The above scenario should never be seen by regular users as this would indicate a code error (vs a data error). However, API users might see the above.

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is identified in the issue. Trace the schema-error handling that produces the API response, compare the expected errors[0].error with the current errors[0].context[0].message, and inspect the missing contactPoint scenario. Done means API users receive the expected meaningful error message and path without the unexpected context shape.

Written by the indexing model from the issue text.

Assessment

Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.