npm.io
1.0.3 • Published 7 years ago

xrtlibrary-bughandler

Licence
BSD-3-Clause
Version
1.0.3
Deps
0
Size
6 kB
Vulns
0
Weekly
0

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