Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[cleanup] Base: remove error

  • Loading branch information...
commit debb5ea5cd5d8e4a3ccf2e575edaa78dd9af5302 1 parent 939bb21
Raja authored
View
2  database/db3/io/ioUnix.ml
@@ -139,7 +139,7 @@ let read_int t =
let read_bytes t l =
if l >= Sys.max_string_length then
- Base.error (Printf.sprintf "read_bytes: limit (%d > %d) exceeded" l Sys.max_string_length)
+ failwith (Printf.sprintf "read_bytes: limit (%d > %d) exceeded" l Sys.max_string_length)
else
Base.String.init l (fun _ -> read_char t)
View
5 libbase/base.ml
@@ -98,7 +98,4 @@ module Obj = BaseObj
module Random = BaseRandom
module Set = BaseSet
module String = BaseString
-module Utf8 = BaseUtf8
-
-(* deprecated *)
-let error = failwith
+module Utf8 = BaseUtf8
View
5 libbase/base.mli
@@ -143,8 +143,3 @@ module Utf8 : module type of BaseUtf8
+ [FBuffer.printf], [SRope.printf]
+ [Printf.sprintf] in any other case.*)
val sprintf : ('a, unit, string) format -> 'a
-
-(**
- deprecated error. is implemeted with a failwith
-*)
-val error : string -> 'a
View
2  libbase/debugTracer.ml
@@ -233,7 +233,7 @@ module MakeDebugInterface (P : INTERFACEPARAMETER)
#<< let plurial, debug_ext = match DebugTracer.ext with >>#;
#<< | [t] -> "", "."^t >>#;
#<< | _::_ as l -> "s", "{"^(String.concat ", " l)^"}" >>#;
-#<< | _ -> Base.error (Printf.sprintf "%s has no tracer-module implemented, and that is sad !" this_id) >>#;
+#<< | _ -> failwith (Printf.sprintf "%s has no tracer-module implemented, and that is sad !" this_id) >>#;
#<< let _prefix = ref ((String.lowercase P.libname)^"diagnostic") >>#;
#<< let set_trace_prefix s = _prefix := s >>#;
#<< let trace ?(verbose=true) () = >>#;
View
2  libqmlcompil/dbGen/dbGen_common.ml
@@ -106,4 +106,4 @@ let engine_opt opts =
match Base.List.filter_map (function `engine e -> Some e | _ -> None) opts with
| [engine] -> engine
| [] -> `db3 None (* default engine, if any requested *)
- | _::_ -> Base.error "Ambiguous database engine specification"
+ | _::_ -> failwith "Ambiguous database engine specification"
View
6 libtrx/pgrammar.ml
@@ -138,16 +138,16 @@ let rewrite_funs pg =
begin match StringMap.find_opt f functions with
| None ->
if StringMap.mem f all_functions then
- B.error (B.sprintf "function %s is recursive" f)
+ failwith (B.sprintf "function %s is recursive" f)
else
- B.error (B.sprintf "function %s is undefined" f)
+ failwith (B.sprintf "function %s is undefined" f)
| Some (fdef, _) ->
let functions = StringMap.remove f functions in
let expected_arity = List.length fdef.P.vars in
if expected_arity = List.length vars then
let bindings = List.fold_left2 (fun acc idfun expra -> StringMap.add idfun (aux_seql expra) acc) bindings fdef.P.vars vars in
rewrite_fun functions bindings fdef.P.expr
- else B.error (B.sprintf "function %s is of arity %d" f expected_arity)
+ else failwith (B.sprintf "function %s is of arity %d" f expected_arity)
end
and aux_seql sl = List.map aux_seq sl
and aux_seq (il, map, code) = List.map aux_item il, map, code
View
4 ocamllang/ocaml.ml
@@ -301,7 +301,7 @@ struct
let app5 a b c d e = app (app4 a b c d) e
let rec app_list = function
- | [] -> error (sprintf "[ ocaml.ml; #83726 ]")
+ | [] -> failwith "[ ocaml.ml; #83726 ]"
| [x] -> x
| [x; y] -> app x y
| ls ->
@@ -362,7 +362,7 @@ struct
(* transforms [a; b; c] into [a -> b -> c] *)
let rec type_arrows = function
- | [] | [_] -> error "[ ocaml.ml; #58253 ] impossible case in type_arrows"
+ | [] | [_] -> failwith "[ ocaml.ml; #58253 ] impossible case in type_arrows"
| [x; y] -> TypeArrow (x, y)
| x::xs -> TypeArrow (x, type_arrows xs)
View
12 ocamllang/ocaml_parser.ml.cache
@@ -2431,7 +2431,7 @@ if ( (((=)) (c) ('*')) ) then ( Some((((succ) (input_54)), c)) ) else ( None ) )
| Some ( ( input_53, __2 ) ) -> Some((input_53,
#82 "ocaml_types.trx"
( match (__1::__2) with
- | [] -> error "@Ocaml_types.typedef_no_arrow : empty type tuple"
+ | [] -> failwith "@Ocaml_types.typedef_no_arrow : empty type tuple"
| [td] -> td
| tdl -> TypeTuple tdl
))))) in
@@ -3191,8 +3191,8 @@ None -> Some((input, None))
( match __2, __3 with
| _, [] -> __2
| TypeConstructor l1, l2 ->
- TypeConstructor ( l1 @ List.flatten (List.map (function | TypeConstructor l -> l | _ -> error "@Ocaml_types.typedeflist : must be a constructor") l2))
-| _x, _xl -> error "@Ocaml_types.typedeflist : impossible"
+ TypeConstructor ( l1 @ List.flatten (List.map (function | TypeConstructor l -> l | _ -> failwith "@Ocaml_types.typedeflist : must be a constructor") l2))
+| _x, _xl -> failwith "@Ocaml_types.typedeflist : impossible"
)))))) in
(Hashtbl.add (memo_Ocaml_types_typedeflist) (input) (res)) ; res)
)
@@ -5400,7 +5400,7 @@ if ( (((=)) (c) ('*')) ) then ( Some((((succ) (input_1008)), c)) ) else ( None )
| Trx_runtime.Ok ( ( ( input_1007, __2 ), err ) ) -> (Trx_runtime.addErrorInfo (err) (Trx_runtime.Ok(((input_1007,
#82 "ocaml_types.trx"
( match (__1::__2) with
- | [] -> error "@Ocaml_types.typedef_no_arrow : empty type tuple"
+ | [] -> failwith "@Ocaml_types.typedef_no_arrow : empty type tuple"
| [td] -> td
| tdl -> TypeTuple tdl
)), ((Trx_runtime.emptyError) (input_1007)))))))))) in
@@ -7443,8 +7443,8 @@ Trx_runtime.Fail ( ( err ) ) -> Trx_runtime.Ok(((input, None), err))
( match __2, __3 with
| _, [] -> __2
| TypeConstructor l1, l2 ->
- TypeConstructor ( l1 @ List.flatten (List.map (function | TypeConstructor l -> l | _ -> error "@Ocaml_types.typedeflist : must be a constructor") l2))
-| _x, _xl -> error "@Ocaml_types.typedeflist : impossible"
+ TypeConstructor ( l1 @ List.flatten (List.map (function | TypeConstructor l -> l | _ -> failwith "@Ocaml_types.typedeflist : must be a constructor") l2))
+| _x, _xl -> failwith "@Ocaml_types.typedeflist : impossible"
)), ((Trx_runtime.emptyError) (input_1001))))))))))))) in
(Hashtbl.add (memo_Ocaml_types_typedeflist_err) (input) (res)) ; res)
)
View
6 ocamllang/ocaml_types.trx
@@ -58,8 +58,8 @@ typedeflist <- Default.bar? typedef (Default.bar typedef {{ __2 }})* {{
match __2, __3 with
| _, [] -> __2
| TypeConstructor l1, l2 ->
- TypeConstructor ( l1 @ List.flatten (List.map (function | TypeConstructor l -> l | _ -> error "@Ocaml_types.typedeflist : must be a constructor") l2))
-| _x, _xl -> error "@Ocaml_types.typedeflist : impossible"
+ TypeConstructor ( l1 @ List.flatten (List.map (function | TypeConstructor l -> l | _ -> failwith "@Ocaml_types.typedeflist : must be a constructor") l2))
+| _x, _xl -> failwith "@Ocaml_types.typedeflist : impossible"
}}
typedef_base <-
@@ -81,7 +81,7 @@ match __2 with
typedef_no_arrow <- typedef_aux ([*] spacing typedef_aux {{__3}})* {{
match (__1::__2) with
- | [] -> error "@Ocaml_types.typedef_no_arrow : empty type tuple"
+ | [] -> failwith "@Ocaml_types.typedef_no_arrow : empty type tuple"
| [td] -> td
| tdl -> TypeTuple tdl
}}
View
8 opalang/syntax/parser_utils.ml
@@ -974,7 +974,7 @@ let action _filename jqs val_css verb e : (_,_) expr_node =
| `magicToXml -> (fun e -> (magic_to_xml e, label val_css)) in
let verb_s,verb_label = verb in
if a = "css" && verb_s <> "set" then
- error (sprintf "In file %s, there is an invalid operation (%s) for CSS. you can only set CSS." _filename verb_s);
+ OManager.error "In file %s, there is an invalid operation (%s) for CSS. you can only set CSS." _filename verb_s;
let record =
record
[("jq", jqs);
@@ -1308,7 +1308,7 @@ let range_convert_utf8 l =
| `char c1 :: tl when c1 < 128 ->
`char c1 :: aux tl
| `char c1 :: _ when c1 < 192 ->
- error "trx_opa.ml > range_translate_utf8 : out of range in a byte (UTF8) [1]"
+ OManager.error "trx_opa.ml > range_translate_utf8 : out of range in a byte (UTF8) [1]"
| `char c1 :: `char c2 :: `char c3 :: `char c4 :: tl when c1 >= 240 ->
`char (build4 c1 c2 c3 c4) :: aux tl
| `char c1 :: `char c2 :: `char c3 :: tl when c1 >= 224 ->
@@ -1320,7 +1320,7 @@ let range_convert_utf8 l =
| [] ->
[]
| _ ->
- error "trx_opa.ml > range_translate_utf8 : out of range in a byte (UTF8) [2]"
+ OManager.error "trx_opa.ml > range_translate_utf8 : out of range in a byte (UTF8) [2]"
in
aux l
@@ -1339,7 +1339,7 @@ let rec range_contract = function
| `char c :: tl ->
`ONE c :: range_contract tl
| _ ->
- error "parser_utils.ml > range_contract"
+ OManager.error "parser_utils.ml > range_contract"
let convert_range rs =
rs |> List.map range_to_ascii |> List.concat_map range_expand |> range_convert_utf8 |> range_contract
View
2  opalang/syntax/xml.trx
@@ -247,7 +247,7 @@ css_size_value <- css_size_with_or_without_expr:e
(* zero is the only value that is allowed not to have a unit *)
record1 "em" (float 0. pos)
else
- error "You have to give a unit for non-zero values in css lengths"
+ failwith "You have to give a unit for non-zero values in css lengths"
| Some "px" ->
record1 "px"
( match value with
View
2  passes/surfaceAstDependencies.ml
@@ -178,7 +178,7 @@ let directive_dependencies filter acc v =
| `magic_to_xml
| `fun_action) as v ->
let str = dir_to_str_fun v in
- let id = try OpaMapToIdent.val_noerr str with Not_found -> Base.error (Printf.sprintf "Please define %s." str) in
+ let id = try OpaMapToIdent.val_noerr str with Not_found -> failwith (Printf.sprintf "Please define %s." str) in
begin match filter with
| None -> add_val id acc
| Some f when f id -> add_val id acc
View
2  passes/surfaceAstTrx.ml
@@ -211,7 +211,7 @@ and translate_seq ~nested ~res_needed org_input (seq, loc) =
(* used names are extended with the optional explicit item name *)
let use_name n =
if StringSet.mem n used_names then
- error (Printf.sprintf "Use of the name %s ambiguous in a parser!" n);
+ failwith (Printf.sprintf "Use of the name %s ambiguous in a parser!" n);
StringSet.add n used_names
in
let used_names = Option.default_map used_names use_name item_name in
Please sign in to comment.
Something went wrong with that request. Please try again.