package sentry

  1. Overview
  2. Docs

Module SentrySource

Sourcemodule Breadcrumb : sig ... end
Sourcemodule Client : sig ... end

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

Sourcemodule Config : sig ... end
Sourcemodule Context : sig ... end
Sourcemodule Dsn : sig ... end
Sourcemodule Event : sig ... end
Sourcemodule Exception : sig ... end
Sourcemodule Platform : sig ... end
Sourcemodule Sdk : sig ... end
Sourcemodule Severity_level : sig ... end
Sourceval 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

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

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

Sourceval 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.

Sourceval set_environment : string -> unit

Override the environment in the current context

Sourceval set_release : string -> unit

Override the release in the current context

Sourceval set_server_name : string -> unit

Override the server name in the current context

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

Merge tags into the current context

Sourceval add_breadcrumb : Breadcrumb.t -> unit

Add a breadcrumb to the current context

Sourceval 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.

Sourceval 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.

Sourceval 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.

Sourceval 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.

Sourceval 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).

Sourceval 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.

Sourceval 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).

Sourceval 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

Sourceval 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.