Properly handle (and log) errors #5

Closed
opened 2022-02-13 17:01:47 +01:00 by paul · 3 comments
Owner

Currently all errors are squashed by using Option and just returning None in case of an error.
It would be better to at least log the error when retrieving the forecast or updating the maps.

Currently all errors are squashed by using `Option` and just returning `None` in case of an error. It would be better to at least log the error when retrieving the forecast or updating the maps.
paul added the
enhancement
label 2022-02-13 17:01:47 +01:00
paul self-assigned this 2022-02-13 17:01:47 +01:00
Author
Owner
Maybe wait for https://github.com/SergioBenitez/Rocket/pull/1579?
Author
Owner

I propose to add the errors field to the JSON (following JSON:API in a way). Note that every metric can have its own errors, that is why it is an array.

So something like:

{
  "lat": 34.567890,
  "lon": 1.234567,
  "time": 1645800043,
  "errors": [
  	{
    	"code": "SomeErr",
        "title": "Something went wrong!",
        "detail": "..."
    }
}

These errors can then be logged.

I propose to add the `errors` field to the JSON (following [JSON:API](https://jsonapi.org/format/#errors) in a way). Note that every metric can have its own errors, that is why it is an array. So something like: ```json { "lat": 34.567890, "lon": 1.234567, "time": 1645800043, "errors": [ { "code": "SomeErr", "title": "Something went wrong!", "detail": "..." } } ``` These errors can then be logged.
paul added this to the 0.3.0 milestone 2022-03-14 17:05:02 +01:00
Collaborator

I propose to add the errors field to the JSON (following JSON:API in a way). Note that every metric can have its own errors, that is why it is an array.

Then how do you know which metric is causing the error? Also: will metrics that did not cause an error still be part of the response?

> I propose to add the `errors` field to the JSON (following [JSON:API](https://jsonapi.org/format/#errors) in a way). Note that every metric can have its own errors, that is why it is an array. Then how do you know which metric is causing the error? Also: will metrics that did not cause an error still be part of the response?
paul added reference handle-errors 2022-05-08 15:06:58 +02:00
paul closed this issue 2022-06-06 16:49:03 +02:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: paul/sinoptik#5
No description provided.