(***********************************************************************)
(*                                                                     *)
(*                                 GALAX                               *)
(*                             XQuery Engine                           *)
(*                                                                     *)
(*  Copyright 2001-2003, Lucent Technologies.                          *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: error.mli,v 1.17 2003/06/12 21:38:06 mff Exp $ *)

(* Module Error
   Description:
     This module deals with error handling in Galax.
*)

type error =
  | Datamodel of string
  | Root
  | Empty_Sequence
  | Not_A_Singleton_Sequence
  | Node_Without_Id
  | URI_Error of string
  | Lexing of Finfo.finfo * string
  | Parsing of Finfo.finfo * string
  | Type_Error of Finfo.finfo * string
  | Static_Type_Error of Finfo.finfo * string
  | Expr_Error of Finfo.finfo * string
  | Bound_Error of Finfo.finfo * string
  | Parameter_Mismatch of string
  | Unknown of string
  | Internal_Error of string
  | Wrong_Args of string
  | Prototype of string
  | Error of string
  | Automata of string
  | Undefined of string
  | Undefined_Variable of string option
  | Symbol_Already_Defined of (Finfo.finfo * string * string)
  | Mapping_Failure of string
  | Unmapped_Type of string
  | Non_Deterministic_Regexp of string
  | Validation of string
  | Load_Error of string
  | Schema of string
  | Not_An_Element
  | Not_An_Attribute
  | Not_A_Unit_Type
  | Algebra of string
  | Statistics of string
  | Toplevel_Error of string
  | Cast_Error of string
  | Key_Error of (string * string)
  | KeyRef_Error of (string * string)
  | Update_Error of Finfo.finfo * string

exception Query of error

val printf_warning  : string -> unit
val eprintf_warning : string -> unit
val bprintf_warning : string -> string

val printf_error  : string -> exn -> unit
val eprintf_error : string -> exn -> unit
val bprintf_error : string -> exn -> string

val printf_error_safe  : string -> exn -> unit
val eprintf_error_safe : string -> exn -> unit
val bprintf_error_safe : string -> exn -> string

val incorrect_arg_count : string -> int -> int -> Finfo.finfo -> exn 

