Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Erlang Hoptoad notification client

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 doc
Octocat-spinner-32 ebin
Octocat-spinner-32 src
Octocat-spinner-32 support
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.textile


An Erlang client for the Hoptoad exception notification service.



1. Sign up for Hoptoad
2. Create a Hoptoad project, and copy the API key
3. Proceed with “Running the Erlhoptoad application” or “Embedding Erlhoptoad in an existing application”

Running the Erlhoptoad application

1. Compile erlhoptoad: cd path/to/erlhoptoad/ && make
2. Start the erlhoptoad application, replacing the API key with your own:

ERL_LIBS="path/to/ibrowse:path/to/erlhoptoad:$ERL_LIBS" erl -erlhoptoad apikey '"76fdb93ab2cf276ec080671a8b3d3866"' -erlhoptoad error_logger true -erlhoptoad environment '"development"' -s erlhoptoad start

3. Try generating a couple of error reports:

1> hoptoad:notify(error, fake, "Testing erlhoptoad with a manual error report", no_module, 0).
2> error_logger:error_msg("A sample error caught by the erlhoptoad error logger.").

4. Configure erlhoptoad: three configuration options are supported: apikey, environment, and error_logger

  • apikey – Set this to the API key of your Hoptoad project (String).
  • environment – The Hoptoad environment that errors will be reported under (String).
  • error_logger – Set to true to enable the erlhoptoad error_logger (Boolean). The erlhoptoad error logger will intergrate with the existing Erlang/OTP error logging, notifying hoptoad of any runtime errors in your application. The upside is that it can catch things that manual hoptoad notification can’t.

These configuration options can be set in ebin/, or configured on the command line as in the above example.

Embedding Erlhoptoad in an existing application

1. Add hoptoad to your application supervision tree:

    {hoptoad, start_link, ["production", "76fdb93ab2cf276ec080671a8b3d3866"]},
    permanent, 5000, worker, dynamic}.

2. Add hoptoad hooks:

case calculate_something() of
    {ok, Value} ->
    Error = {error, Reason} ->
        hoptoad:notify(error, Reason, "Frobber calculation failed", ?MODULE, ?LINE)


try do_stuff() of
    Value ->
    Type:Reason ->
        hoptoad:notify(Type, Reason, "Ahhh! Stuff is not good!", ?MODULE, ?LINE, erlang:get_stacktrace())

3. Compile erlhoptoad: cd path/to/erlhoptoad/ && make
4. Add the erlhoptoad ebin directory to your Erlang path: -pa path/to/erlhoptoad/ebin
5. Start ibrowse during your application startup: application:start(ibrowse)
6. Test it out!
7. (Optional) Add the erlhoptoad error logger to your application startup:



A macro similar to this is likely useful to avoid duplication:

-define(NOTIFY_HOPTOAD(Type, Reason, Message),
        hoptoad:notify(Type, Reason, Message, ?MODULE, ?LINE, erlang:get_stacktrace())).

If you already have a macro to log errors, just add it to that :)

Something went wrong with that request. Please try again.