From 025d42b44ae2c612aeab57171cb417ae7385bf44 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Fri, 26 Jan 2024 15:49:25 +0100 Subject: [PATCH] close the driver on crash --- bin/main.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/main.ml b/bin/main.ml index 7ffd225..fed3180 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -6,7 +6,12 @@ open Twitter let start driver = let name_driver = prepare driver in let data_driver = run_process name_driver [] in - let session_id = get_session () in + let session_id = + try get_session () with + | Any msg -> + stop_process data_driver; + raise (Any ("Can't get the session ID: " ^ msg)) + in data_driver, session_id ;;