package sentry

  1. Overview
  2. Docs
module Breadcrumb : sig ... end
module Client : sig ... end

Low level functions to access the Sentry API. You probably want the high level functions in sentry.ml

module Config : sig ... end
module Context : sig ... end
module Dsn : sig ... end
module Event : sig ... end
module Exception : sig ... end
module Platform : sig ... end
module Sdk : sig ... end
module Severity_level : sig ... end
val with_dsn : Dsn.t -> (unit -> 'a) -> 'a

with_dsn dsn f overrides the default DSN (from the environment variable SENTRY_DSN) within the execution of f

val with_context : Context.t -> (unit -> 'a) -> 'a

with_context f sets the current thread-local context and runs f with it.

val with_new_context : ?tags:(string * string) list -> (Context.t -> 'a) -> 'a

Like with_new_context but creates the new context for you as a copy of the current context. ~tags will be merged into the new context.

val set_environment : string -> unit

Override the environment in the current context

val set_release : string -> unit

Override the release in the current context

val set_server_name : string -> unit

Override the server name in the current context

val merge_tags : (string * string) list -> unit

Merge tags into the current context

val add_breadcrumb : Breadcrumb.t -> unit

Add a breadcrumb to the current context

val capture_message : ?tags:(string * string) list -> string -> unit

capture_message ?tags ?dsn message uploads a message to Sentry using the given dsn (or looking it up in the environment).

If you pass tags, it will be as if you called with_tags before this function.

val capture_exception : ?tags:(string * string) list -> ?message:string -> exn -> unit

capture_exception ?dsn ?message e records the backtrace from e and an optional message and uploads it to Sentry.

If you pass tags, it will be as if you called with_tags before this function.

val capture_error : ?tags:(string * string) list -> Core_kernel.Error.t -> unit

capture_error ?dsn ?message e records the backtrace from e and uploads it to Sentry.

If you pass tags, it will be as if you called with_tags before this function.

val with_exn_handler : (unit -> 'a) -> 'a

with_exn_handler ?dsn f runs f. If f throws an exception, it will be uploaded to Sentry and then re-reraised.

val with_exn_handler_ignore : (unit -> unit) -> unit

with_exn_handler ?dsn f is like context except exceptions will not be re-raised. Use this if you're using Sentry in a loop where you want to report on errors and then continue (like in an web server).

val with_error_and_exn_handler : (unit -> 'a Core_kernel.Or_error.t) -> 'a Core_kernel.Or_error.t

with_error_and_exn_handler ?dsn f runs f. If f throws an exception or error, it will be uploaded to Sentry and then re-raised or returned. Note that Error.t does not handle backtraces as well as exceptions.

val with_async_exn_handler : (unit -> 'a Async_kernel.Deferred.t) -> 'a Async_kernel.Deferred.t

with_async_exn_handler f runs f. If f throws one or more exceptions, they will be uploaded to Sentry. The first raised exception willl be re-raised (multiple exceptions could be raised to the Async monitor but only one can be re-raised).

val with_async_exn_handler_ignore : (unit -> unit Async_kernel.Deferred.t) -> unit Async_kernel.Deferred.t

See with_exn_handler_ignore and with_async_exn_handler

val with_async_error_and_exn_handler : (unit -> 'a Async_kernel.Deferred.Or_error.t) -> 'a Async_kernel.Deferred.Or_error.t

with_async_error_and_exn_handler f runs f. If f throws an exception or returns an error, it will be uploaded to Sentry and then re-raised or returned.

OCaml

Innovation. Community. Security.