Module JavaError

module JavaError: sig .. end
Utility functions for Java errors.


Instance creation

 
type t = java'lang'Error java_instance
The type of errors.
 
val make : ?cause:t -> ?message:JavaString.t -> unit -> t
Returns a new java.lang.Error instance; see Error(...).
 

Throw

 
val throw : t -> 'a
Synonym for Java.throw.
 

Base methods

 
val get_cause : t -> java'lang'Throwable java_instance
Returns the case; see getCause(...).
 
val get_message : t -> JavaString.t
Returns the message; see getMessage(...).
 
val get_stack_trace : t -> java'lang'StackTraceElement java_instance java_reference_array
Returns the stack trace; see getStackTrace(...).
 
val print_stack_trace : t -> unit
Returns the stack trace; see printStackTrace(...).
 

Null value

 
val null : t
The null value.
 
val is_null : t -> bool
is_null obj returns true iff obj is equal to null.
 
val is_not_null : t -> bool
is_not_null obj returns false iff obj is equal to null.
 

Miscellaneous

 
val wrap : t -> t option
wrap obj wraps the reference obj into an option type:
  • Some x if obj is not null;
  • None if obj is null.

 
val unwrap : t option -> t
unwrap obj unwraps the option obj into a bare reference:
  • Some x is mapped to x;
  • None is mapped to null.