Skip to content
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

Error cases while fetching warmup data for new SSE clients aren't handled properly #245

Open
fusion44 opened this issue Feb 25, 2024 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@fusion44
Copy link
Owner

Currently, the warm-up code assumes that a BaseModel will be returned at all times. Actually an HTTPException can be returned on error.

code:

_send_sse_event(id, SSE.SYSTEM_INFO, res[0].dict()),

refs raspiblitz/raspiblitz#4437

@fusion44 fusion44 added the bug Something isn't working label Feb 25, 2024
@fusion44 fusion44 self-assigned this Feb 25, 2024
@fusion44 fusion44 added this to the V0.6.0-beta milestone Feb 25, 2024
@fusion44 fusion44 changed the title Error cases in warmup data aren't handled properly Error cases while fetching warmup data for new SSE clients aren't handled properly Feb 25, 2024
@fusion44
Copy link
Owner Author

If something happend during fetching of the warm-up data the log files will now properly print the error:

Feb 25 08:27:58 python[2332042]: 2024-02-25 08:27:58 | ❌ | main.py:290 | Error while fetching warmup_data for system_info: 410: Something bad happened

In this example, the code raises the following exception.

        raise HTTPException(status.HTTP_410_GONE, detail="Something bad happened")

The client will receive an event with the following data:

event: system_info
data: {"error": "410: Something bad happened"}

@cstenglein You might have to add a code path for this case. Is this OK client side or would you prefer the error format like this:

event: system_info
data: {
  "error": {
    "status": 410,
    "message":  "Something bad happened"
   }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant