Improve error for unknown topics

This commit is contained in:
Sven van Heugten 2026-01-05 22:06:18 +01:00
parent 52e0ec85e9
commit e792a57cb4
2 changed files with 2 additions and 2 deletions

View file

@ -9,7 +9,7 @@ type Event =
| TimeChanged of DateTime
type ParseZigbeeEventError =
| UnknownTopic
| UnknownTopic of string
| InvalidJson
| MissingTypeField
| MissingDataField

View file

@ -37,5 +37,5 @@ let parseZigbeeEvent (message: Message) =
| Some(JsonValue.String "off") -> Ok(ButtonPress PressedOff)
| Some _ -> Error InvalidActionField
| None -> Error MissingActionField
| _ -> return! Error UnknownTopic
| _ -> return! Error <| UnknownTopic message.Topic
}