Node.js catcher for Hawk
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Node.js errors Catcher module for


Register an account and get a project token.

Install module

Use npm to install Catcher

$ npm install @codexteam/hawk.nodejs --save

Download and require node.js file

You can download this repository and require Hawk.nodejs file in your project.

require './hawk.nodejs/src/hawk';

Init HawkCatcher

Create an instance with token to the entry point of your project.

var hawkCatcher = require('@codexteam/hawk.nodejs')({
  accessToken: "69d86244-f792-47ad-8e9a-23fee358e062"

Custom Hawk server

If you want to use custom Hawk server then pass a url to this catcher.

var hawkCatcher = require('@codexteam/hawk.nodejs')({
  accessToken: "69d86244-f792-47ad-8e9a-23fee358e062",
  url: ""


You can catch global Exceptions


If you provide callback function – it will be called after Exception would be caught by Hawk.

hawkCatcher.initGlobalCatcher(function (error, response, body) {
  console.log('Hawk response: ', body);

Catch exception manually

You can catch exceptions by yourself without enabling handlers.

try {
  throw new Exception("");
} catch (e) {
  hawkCatcher.catchException(e, {comment: "Exception in general module"});

The catchException method has two optional arguments:

  • custom - [optional] dictionary with the following structure
    • comment - error description
  • callback - [optional] callback function
try {
  throw new Exception('');
} catch (e) {
  hawkCatcher.catchExceptionPromise(e, {comment: 'Exception in general module'})
    .then(function (result) {
    .catch(function (err) {
      console.log('Error occured: ', err);

The catchExceptionPromise method returns Promise and has one optional argument:

  • custom - [optional] dictionary with the following structure
    • comment - error description



Report a bug:

CodeX Team: