summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/leda.ml18
1 files changed, 14 insertions, 4 deletions
diff --git a/bin/leda.ml b/bin/leda.ml
index 98e6244..c32f3a5 100644
--- a/bin/leda.ml
+++ b/bin/leda.ml
@@ -16,7 +16,7 @@ module R = Gemini.GeminiTransaction.GeminiTransaction(T)(Gemini.TlsUtils.TlsUtil
let () =
Lwt_main.run begin
let%lwt () = Mirage_crypto_rng_lwt.initialize () in
- let request : (R.request, string) Base.Result.t = R.make_request (Sys.get_argv()).(1) in
+ let request = R.make_request (Sys.get_argv()).(1) in
let rec loop t =
match%lwt Lwt_stream.next (Term.events t) with
| `Key _ -> Lwt.return ()
@@ -44,8 +44,18 @@ let () =
let%lwt () = Term.image t (h <-> c) in
let%lwt () = Term.refresh t in
loop t
- | Error m ->
+ | Error R.TOO_MANY_REDIRECTS ->
let%lwt () = Term.release t in
- Lwt_io.printl m)
- | Error m -> Lwt_io.printl m
+ Lwt_io.printl "Too many redirects"
+ | Error (R.X_DOMAIN_REDIR _) ->
+ let%lwt () = Term.release t in
+ Lwt_io.printl ("Attempted to redirect across domains")
+ | Error (UNKNOWN_RESPONSE s) ->
+ let%lwt () = Term.release t in
+ Lwt_io.printl ("Unknown response: " ^ s)
+ | Error (MISC s) ->
+ let%lwt () = Term.release t in
+ Lwt_io.printl ("Error: " ^ s))
+ | Error m ->
+ Lwt_io.printl m
end