Revision 9e70bd652480f6a463d67ce8ba20e43579eae225 authored by Andrea Cerone on 12 February 2024, 13:45:56 UTC, committed by Andrea Cerone on 19 February 2024, 15:18:29 UTC
1 parent 3ae72b0
Raw File
TzCore.ml
(*****************************************************************************)
(*                                                                           *)
(* Open Source License                                                       *)
(* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com>     *)
(* Copyright (c) 2019 Nomadic Labs <contact@nomadic-labs.com>                *)
(*                                                                           *)
(* Permission is hereby granted, free of charge, to any person obtaining a   *)
(* copy of this software and associated documentation files (the "Software"),*)
(* to deal in the Software without restriction, including without limitation *)
(* the rights to use, copy, modify, merge, publish, distribute, sublicense,  *)
(* and/or sell copies of the Software, and to permit persons to whom the     *)
(* Software is furnished to do so, subject to the following conditions:      *)
(*                                                                           *)
(* The above copyright notice and this permission notice shall be included   *)
(* in all copies or substantial portions of the Software.                    *)
(*                                                                           *)
(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)
(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  *)
(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL   *)
(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)
(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING   *)
(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER       *)
(* DEALINGS IN THE SOFTWARE.                                                 *)
(*                                                                           *)
(*****************************************************************************)

(* Tezos Protocol Implementation - Error Monad *)

(*-- Error classification ----------------------------------------------------*)

module Core_category = struct
  (* The categories for core errors are not used. This is kept to
     avoid a large diff, but this should be replaced by 'unit' at some point *)

  (** Categories of error *)
  type t =
    [ `Branch  (** Errors that may not happen in another context *)
    | `Temporary  (** Errors that may not happen in a later context *)
    | `Permanent  (** Errors that will happen no matter the context *) ]

  let default_category = `Temporary

  let string_of_category = function
    | `Permanent -> "permanent"
    | `Temporary -> "temporary"
    | `Branch -> "branch"

  let classify = function
    | `Permanent -> Error_classification.Permanent
    | `Temporary -> Temporary
    | `Branch -> Branch
end

include
  Core_maker.Make
    (struct
      let id = ""
    end)
    (Core_category)
back to top