Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace ioReporter

Index

Functions

errorToAttachment

  • errorToAttachment(error: any): any
  • description

    Transforms an error to an attachment

    example
    Example of error
    {
    name: "TypeError",
    message: "s is not defined",
    status: 500,
    stack: "..."
    }
    example
    Example of return
    {
    fallback: error.name + ': ' + error.message,
    color: 'danger',
    title: error.name + ': ' + error.message,
    fields: [{
    title: 'Status Code',
    value: error.status,
    short: true
    }],
    text: [{
    title: 'Stack',
    code: error.stack
    }],
    mrkdwn_in: ['text'],
    footer: 'ioReporter',
    ts: parseInt(Date.now() / 1000)
    }

    Parameters

    • error: any

    Returns any

    JSON object

executeTest

  • executeTest(): Promise<void>

init

  • init(app: any, webhook: string, apiChannel: string, appChannel: string, message?: any, onRequest?: boolean): void
  • description

    Start ioReporter

    Parameters

    • app: any

      ExpressJS app

    • webhook: string

      URL of the RocketChat Webhook

    • apiChannel: string

      Channel to receive API errors

    • appChannel: string

      Channel to receive APP/(from route) errors

    • message: any = ...

      Response that the API sends on error

    • onRequest: boolean = true

      If set to "TRUE", listens for errors while the request is being processed

    Returns void

sendMessage

  • sendMessage(message: any, callback?: CallbackFunction): void
  • example
    Example for Object
    {
    text (optional): "test",
    attachment (optional): See 'errorToAttachment' for more info
    }

    Parameters

    • message: any

      Message to send, can be string or error(object)

    • Optional callback: CallbackFunction

    Returns void

Generated using TypeDoc