diff options
author | Clombrong <cromblong@egregore.fun> | 2025-06-11 17:16:56 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-06-11 17:16:56 +0200 |
commit | 83b07678994d774ebc22cf387229ed7620d7708e (patch) | |
tree | 8b5371c47c1eb9c47ed1f23c42dc51a1053c70a7 /lib | |
parent | ddf8091355e2093343fa73675358548389da93a3 (diff) |
feat(stream): add ClosedStream exception
Diffstat (limited to 'lib')
-rw-r--r-- | lib/auth.ml | 4 | ||||
-rw-r--r-- | lib/stream.ml | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/auth.ml b/lib/auth.ml index c1486d6..606beb6 100644 --- a/lib/auth.ml +++ b/lib/auth.ml @@ -43,5 +43,7 @@ let send_auth_stanza (stream, push) jid pass mechanism = in Markup.(stanza_list |> of_list |> write_xml |> to_string) |> Option.some |> push; let* response = Lwt_stream.get stream in try - Option.get response |> parse_sasl_response |> Lwt.return + match response with + | Some stanza -> parse_sasl_response stanza |> Lwt.return + | None -> Lwt.fail Stream.ClosedStream with exn -> Lwt.fail exn diff --git a/lib/stream.ml b/lib/stream.ml index 8c7a8f3..25b6822 100644 --- a/lib/stream.ml +++ b/lib/stream.ml @@ -1,5 +1,6 @@ open Lwt.Syntax +exception ClosedStream exception InvalidStanza of string let start domain : Portal.t Lwt.t = |