Skip to content

Commit

Permalink
Fix server FrontendError crashes (issue #983)
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Feb 15, 2023
1 parent 18a9ba8 commit 3d3f183
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/util/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ let () =
try
analyze serve ~reset;
{status = if !Goblintutil.verified = Some false then VerifyError else Success}
with Sys.Break ->
with
| Sys.Break ->
{status = Aborted}
| Maingoblint.FrontendError message ->
Response.Error.(raise (make ~code:RequestFailed ~message ()))
end);

register (module struct
Expand Down Expand Up @@ -289,13 +292,16 @@ let () =
type params = unit [@@deriving of_yojson]
type response = Yojson.Safe.t [@@deriving to_yojson]
let process () s =
if GobConfig.get_bool "server.reparse" then (
GoblintDir.init ();
Fun.protect ~finally:GoblintDir.finalize (fun () ->
ignore Maingoblint.(preprocess_files () |> parse_preprocessed)
)
);
Preprocessor.dependencies_to_yojson ()
try
if GobConfig.get_bool "server.reparse" then (
GoblintDir.init ();
Fun.protect ~finally:GoblintDir.finalize (fun () ->
ignore Maingoblint.(preprocess_files () |> parse_preprocessed)
)
);
Preprocessor.dependencies_to_yojson ()
with Maingoblint.FrontendError message ->
Response.Error.(raise (make ~code:RequestFailed ~message ()))
end);

register (module struct
Expand Down

0 comments on commit 3d3f183

Please sign in to comment.