123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051(******************************************************************************)(* This file is part of Waterproof-lib. *)(* *)(* Waterproof-lib is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU General Public License as published by *)(* the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* Waterproof-lib is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU General Public License for more details. *)(* *)(* You should have received a copy of the GNU General Public License *)(* along with Waterproof-lib. If not, see <https://www.gnu.org/licenses/>. *)(* *)(******************************************************************************)openPp(**
Basic exception info
*)letfatal_flag:'aExninfo.t=Exninfo.make()(**
Type of exceptions used in Wateproof
*)typewexn=|CastErrorofstring(** Indicates that a cast made by the FFI has failed *)|FailedAutomationofstring(** Indicates that the automatic solver called has failed *)|FailedTestofstring(** Indicates that the running test has failed *)|NonExistingDatasetofHints.hint_db_name(** Indicates that the user tried to import a non-existing hint dataset *)|UnusedLemmas(** Indicates that no proof using all the given lemmas has been found *)(**
Converts errors to displayable messages
*)letpr_wexn(exn:wexn):t=matchexnwith|CastErrormessage->str"Cast error: "++strmessage|FailedAutomationmessage->str"Automatic solving failed: "++strmessage|FailedTesttest->str"Failed test: "++strtest|NonExistingDatasetdataset->str"Non existing dataset: the dataset "++strdataset++str" is not defined"|UnusedLemmas->str"No proof using all given lemmas has been found"(**
Throws an error with given info and message
*)letthrow?(info:Exninfo.info=Exninfo.null)(exn:wexn):'a=letfatal=Exninfo.addinfofatal_flag()inCErrors.user_err?info:(Somefatal)(pr_wexnexn)