thatmattlove / hyperglass

hyperglass is the network looking glass that tries to make the internet better.
https://hyperglass.dev
BSD 3-Clause Clear License
594 stars 88 forks source link

v2.0.0 'ValidationException' object has no attribute 'errors' #243

Closed f0o closed 1 month ago

f0o commented 3 months ago

Bug Description

When a validation fails, instead of logging the error it will raise an exception about missing attribute 'errors' on ValidationException

Likely culprit: https://github.com/thatmattlove/hyperglass/blob/be09dbc476fa9e35078fd6a648d6756a9c34b0b9/hyperglass/api/error_handlers.py#L51

Expected behavior

No clue this is on a built-in directive - it should be just working. The ValidationError is already a bug in itself.

Steps to Reproduce

Local Configurations

Kept everything defaults apart from adding a FRR instance in devices.yaml

Logs

[CRITICAL] 20240403 13:51:29 | hyperglass.api.error_handlers:21 | default_handler → POST /api/query 'ValidationException' object has no attribute 'errors'
[CRITICAL] 20240403 13:51:29 | hyperglass.api.error_handlers:21 | default_handler → POST /api/query 'ValidationException' object has no attribute 'errors'

Possible Solution

https://github.com/thatmattlove/hyperglass/blob/be09dbc476fa9e35078fd6a648d6756a9c34b0b9/hyperglass/api/error_handlers.py#L51 raises the exception - unclear why it's even caused since * from the directive should allow for any input.

Environment

Server

v2.0.0 on Docker using the docker-compose yaml in that branch

Client

Smartphone Details (if applicable)

thatmattlove commented 1 month ago

Hello,

I've just pushed dd2ce83 which should fix this. I don't have time to do a reproduction of the issue and fully test it, though. I'll leave this issue open so you can test it out and report back.