Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RollbarController

The wrapper around Rollbar. Presents a nice functional API.

Hierarchy

  • RollbarController

Index

Properties

Private _enabled

_enabled: boolean = false

If true, we will send messages. We must get the user's permission first!

Private _rollbar

_rollbar: Rollbar = new Rollbar({accessToken: '14d411d713be4a5a9f9d57660534cac7',reportLevel: 'error',payload: this._payload,})

The Rollbar client instance we use to communicate.

Methods

error

  • error(what: string, additional?: object): LogResult | null
  • Log an error with Rollbar

    Parameters

    • what: string

      A message about what we were doing when the error happened

    • Default value additional: object = {}

      Additional items in the payload

    Returns LogResult | null

    The LogResult if we are enabled. null otherwise.

exception

  • exception(what: string, exception: Error, additional?: object): LogResult | null
  • Log an exception with Rollbar.

    Parameters

    • what: string

      A message about what we were doing when the exception happened

    • exception: Error

      The exception object

    • Default value additional: object = {}

      Additional items in the payload

    Returns LogResult | null

    The LogResult if we are enabled. null otherwise.

info

  • info(what: string, additional?: object): LogResult | null
  • Parameters

    • what: string
    • Default value additional: object = {}

    Returns LogResult | null

invoke

  • invoke<T>(what: string, additional: object, func: function): T
  • invoke<T>(what: string, func: function): T
  • Invoke a synchronous function, and catch and log any unhandled exceptions

    Type parameters

    • T

    Parameters

    • what: string

      Message about what we are doing

    • additional: object

      Additional data to log

    • func: function

      The block to call

        • (): T
        • Returns T

    Returns T

  • Type parameters

    • T

    Parameters

    • what: string
    • func: function
        • (): T
        • Returns T

    Returns T

invokeAsync

  • invokeAsync<T>(what: string, additional: object, func: function): void
  • invokeAsync<T>(what: string, func: function): void
  • Invoke an asynchronous function, and catch any promise rejects.

    Type parameters

    • T

    Parameters

    • what: string

      Message about what we are doing

    • additional: object

      Additional data to log

    • func: function

      The block to call

        • (): Thenable<T>
        • Returns Thenable<T>

    Returns void

  • Type parameters

    • T

    Parameters

    • what: string
    • func: function
        • (): Thenable<T>
        • Returns Thenable<T>

    Returns void

requestPermissions

  • requestPermissions(extensionContext: vscode.ExtensionContext): Promise<void>
  • Request permission to use Rollbar from the user. This will show a message box at the top of the window on first permission request.

    Parameters

    • extensionContext: vscode.ExtensionContext

      Extension context, where we use a memento to remember our permission

    Returns Promise<void>

takePromise

  • takePromise<T>(what: string, additional: object, pr: Thenable<T>): void
  • Type parameters

    • T

    Parameters

    • what: string
    • additional: object
    • pr: Thenable<T>

    Returns void

updatePayload

  • updatePayload(data: object): void
  • Update the content of the Rollbar payload with additional context information.

    Parameters

    • data: object

      Daya to merge into the payload

    Returns void

Object literals

Private _payload

_payload: object

The payload to send with any messages. Can be updated via updatePayload.

platform

platform: string = "client"

server

server: object

root

root: string = SRC_ROOT

Generated using TypeDoc