1.0.3 • Published 5 years ago

xrtlibrary-bughandler v1.0.3

Weekly downloads
-
License
BSD-3-Clause
Repository
-
Last release
5 years ago

XRTLibrary-BugHandler

Introduction

A simple bug handler module.

Installation

To install this package, you can use NPM by typing following command:

npm install xrtlibrary-bughandler --save

Then you can import this library in your JavaScript code:

const XRTLibBugHandler = require("xrtlibrary-bughandler");

APIs

ReportBug(message, thrown=false, ecls=Error)

Report bug.

Note(s):

  • If there is no bug handler registered, the message and the stack would be printed to standard error.

Parameter(s):

  • message (String): The bug message.
  • thrown (Boolean): (Optional) True if the error should be thrown (default: false).
  • ecls ({new(message: String): Error}): (Optional) The error class (default: Error).

RegisterBugHandler(handler)

Register a bug handler.

Parameter(s):

  • handler ((error: Error) => void): The bug handler.

UnregisterBugHandler

Unregister a bug handler.

Parameter(s):

  • handler ((error: Error) => void): The bug handler.

Return value:

  • (Boolean) True if succeed (false if the handler was not registered).