PackagePackagetypeA library you install and call yourself.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

openui5-error-collector

A UI5 library that collects a running app's JavaScript errors, unhandled Promise rejections and UI5 log events, and can post them to a backend with navigator.sendBeacon.

Errors in a browser app are visible only in the user's console unless something gathers them. This library collects plain JavaScript errors, unhandled Promise rejections, UI5 log events from sap/base/Log and Reporting API errors, keeps them behind ui5ErrorCollector.getErrors() and, once serverUrl is set through setConfiguration, posts them with navigator.sendBeacon. An onSyncHook callback replaces that sender, which is the route for IE11, where sendBeacon is unsupported, or for sending to several backends. The script is loaded before sap-ui-bootstrap, so errors raised while UI5 itself boots are collected too. It is a client-side collector only: the receiving backend is not part of it.

Facts

Latestv1.1.0ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
LoggingUI5LoggingcapabilitySeeing what a running service did, in a form something can read afterwards — levels, a formatter that suits a laptop and one that suits a log service.

Who is behind it

Mauricio LaufferMauricio LaufferPersonMaintains this
In the atlas: maintains 16, contributes to 41, wrote 4
@mauriciolauffer
maintainer

Before choosing this

Signals

ActivityQuietRelease and repository quiet for 43 months

Both observable publication channels have been quiet for at least 24 full months. This may be normal for stable software; check whether its current state still fits your use.

What it declares

Every artifact

Type
Package
Origin
Independently maintained

As a package

Where it runs
Inside its host
Distributed through
npm

Connections1

Install

npm add openui5-error-collector

Derived from the package name. No recipe recorded; the README has the configuration.

README

quoted from mauriciolauffer/openui5-error-collector under MIT, read
mauriciolauffer/openui5-error-collector/README.mdOn GitHub

openui5-error-collector

npm test

This library collects javascript errors and can send them to a backend, if errors need to be logged and saved for further analysis:

Demo

You can check out a live demo here:

https://mauriciolauffer.github.io/openui5-error-collector/demo/index.html

Project Structure

  • demo - Library's live demo
  • dist - Distribution folder which contains the library ready to use
  • src - Development folder
  • test - Testing framework for the library

Getting started

Installation

Install openui5-error-collector as an npm module

$ npm install openui5-error-collector
How to use

Import openui5-error-collector to your UI5 application as a regular javascript file. You should import it before sap-ui-bootstrap to capture UI5 bootstrap errors as well.

<script async src="dist/ui5ErrorCollector.min.js"></script>
<script async id="sap-ui-bootstrap" src="/resources/sap-ui-core.js" ... ></script>

Once imported, all errors will be automatically captured. It also exposes a global variable ui5ErrorCollector, eg, window.ui5ErrorCollector which can be used to get the errors and to set the details to send them to a backend server.

Sending errors to a backend

Developers can send all errors to a backend server setting serverUrl with method ui5ErrorCollector.setConfiguration. Once serverUrl is set, errors'll be sent to it using navigator.sendBeacon (this is not supported by IE11).

ui5ErrorCollector.setConfiguration({
  serverUrl: 'https://my-backend-server.com'
});

To make it compatible with IE11, or to add any extra logic when synchronizing (transform the payload, send to multiple backends, etc), a callback onSyncHook can be passed to method ui5ErrorCollector.setConfiguration. This'll replace the default behaviour and use the provided callback onSyncHook rather than navigator.sendBeacon.

/**
 * Callback provided to replace default sync with backend server
 *
 * @param {string} serverUrl - Server URL
 * @param {UI5ErrorLogEvent[]} errors - List of captured errors, same as ui5ErrorCollector.getErrors() results
 */
function myCustomOnSyncHook(serverUrl, errors) {
  // Go crazy, do whatever you wanna here...
  const payload = JSON.stringify(errors);
  fetch(serverUrl, {body: payload, method: 'POST'});
  $.ajax(serverUrl, {body: payload, method: 'POST'});
}

ui5ErrorCollector.setConfiguration({
  serverUrl: 'https://my-backend-server.com',
  onSyncHook: myCustomOnSyncHook
});
Retrieving errors

Mehod ui5ErrorCollector.getErrors will return all captured errors.

ui5ErrorCollector.getErrors(); // Which returns an array of the following object:

/**
* @type {object}
* @property {string} type - Log event type
* @property {string} timestamp - When event was logged
* @property {string} uri - Where event was logged
* @property {?string} stack - Error stack
* @property {string} message - Error message
* @property {?string} component - UI5 Log component
* @property {number} level - Log level
* @property {?number} elapsedTimestamp - Elapsed time since page load
* @property {?string} filename - File which triggered the error
*/

// Some data sample:
[
  {
      "type": "error",
      "timestamp": "2022-02-14T05:59:02.987Z",
      "uri": "http://localhost:3000/test/webapp/index.html",
      "stack": "TypeError: Cannot read properties of undefined (reading 'substring')\n    at http://localhost:3000/test/webapp/index.html:30:40",
      "message": "Uncaught TypeError: Cannot read properties of undefined (reading 'substring')",
      "component": null,
      "level": 1,
      "elapsedTimestamp": 755.1999999880791,
      "filename": "http://localhost:3000/test/webapp/index.html"
  },
  {
      "type": "deprecation",
      "timestamp": "2022-02-14T05:59:03.294Z",
      "uri": "http://localhost:3000/test/webapp/index.html",
      "stack": null,
      "message": "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.",
      "component": "XMLHttpRequestSynchronousInNonWorkerOutsideBeforeUnload",
      "level": 1,
      "elapsedTimestamp": null,
      "filename": "https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
  },
  {
      "type": "ui5",
      "timestamp": "2022-02-14T05:59:03.880Z",
      "uri": "http://localhost:3000/test/webapp/index.html",
      "stack": "Error: failed to load JavaScript resource: openui5/errorcollector/Component-preload.js\n    at mapUi5LogEntry (http://localhost:3000/src/ui5ErrorCollector.js:39:17)\n    at Object.logUi5LogEntry [as onLogEntry] (http://localhost:3000/src/ui5ErrorCollector.js:26:24)\n    at Object.onLogEntry (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:124:143)\n    at f (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:135:551)\n    at Object.L.error (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:126:27)\n    at h.error (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:141:109)\n    at HTMLScriptElement.p (https://openui5.hana.ondemand.com/resources/sap-ui-core.js:60:413)",
      "message": "failed to load JavaScript resource: openui5/errorcollector/Component-preload.js",
      "component": "sap.ui.ModuleSystem",
      "level": 1,
      "elapsedTimestamp": null,
      "filename": null
  },
  {
      "type": "unhandledrejection",
      "timestamp": "2022-02-14T05:59:05.316Z",
      "uri": "http://localhost:3000/test/webapp/index.html",
      "stack": null,
      "message": 12345,
      "component": null,
      "level": 1,
      "elapsedTimestamp": 3084.199999988079,
      "filename": null
  }
]

Author

Mauricio Lauffer

linkedin-shield npm-shield github-shield sap-shield credly-shield

MIT, read

History

Latest

v1.1.0

Features 1

Notes
Features
  • Set last syncronization time (637d147)
  1. v1.0.1

    Fixes 2

    Notes
    Bug Fixes
  2. v1.0.0

    Features 5, Fixes 1

    Notes
    Features
    • Add option to send errors to a server (#4) (6e9cb6b)
    • Add support to Report API (9f57b39)
    • First draft (59ad363)
    • First version (#2) (0341aab)
    • Hook to change behaviour when send to server (9ec2119)
    Bug Fixes
9downloads per week, npm
Weekly downloads for openui5-error-collector26 complete calendar weeks from 2026-04-20 to 2026-10-18; the latest total is 9.20 Apr – 26 Apr: 1027 Apr – 3 May: 354 May – 10 May: 2111 May – 17 May: 2918 May – 24 May: 3525 May – 31 May: 141 Jun – 7 Jun: 168 Jun – 14 Jun: 2715 Jun – 21 Jun: 1222 Jun – 28 Jun: 2129 Jun – 5 Jul: 166 Jul – 12 Jul: 1313 Jul – 19 Jul: 920 Jul – 26 Jul: 1027 Jul – 2 Aug: 43 Aug – 9 Aug: 710 Aug – 16 Aug: 2517 Aug – 23 Aug: 1224 Aug – 30 Aug: 1031 Aug – 6 Sept: 47 Sept – 13 Sept: 814 Sept – 20 Sept: 1121 Sept – 27 Sept: 128 Sept – 4 Oct: 115 Oct – 11 Oct: 1312 Oct – 18 Oct: 9
Logging
  1. ABAP-LoggerLogging library for ABAP over the Application Logfrom ABAP
  2. abap-log-exporterExports Business Application Log entries to Graylog or Lokifrom ABAP
  3. ABAP-PRCFramework for multi-step ABAP processes with monitoringfrom ABAP
  4. SAP Application Logging service for SAP BTPCollects Cloud Foundry or Kyma logs into a searchable Kibanafrom BTP/BAIP
  5. SAP Cloud LoggingOpenSearch-based store for logs, metrics and tracesfrom BTP/BAIP
  6. com.sap.cds:cds-services-bomMaven bill of materials pinning CAP Java module versionsfrom CAP
  7. @cap-js/audit-loggingCAP integration with the SAP Audit Log servicefrom CAP
  8. abap-logABAP logging library with one interface across output targetsfrom ABAP
  9. ABAP_LOGGINGObject-oriented wrapper around the Business Application Logfrom ABAP
  10. abap-cloud-loggerChainable logger for ABAP Cloud around CL_BALI_LOGfrom ABAP
  11. abap-fm-loggerLogger storing RFC function module call parameters as JSONfrom ABAP
  12. open-abap-balApplication logging for ABAP transpiled to JavaScript on Node.jsfrom ABAP
  13. @openui5/sap.ui.coreFramework core: module loader, MVC runtime, binding, routing, themingfrom UI5
  14. abap-fluentdFluentd client in ABAP for sending log lines to a collectorfrom ABAP
  15. @saptools/cf-logsLog fetcher and parser for one Cloud Foundry appfrom BTP/BAIP
  16. @saptools/cf-tailMerged log tail of every started app in a Cloud Foundry spacefrom BTP/BAIP
  17. sap-usi-logging-apiObject-oriented wrapper around SAP's Application Log (SLG1)from ABAP
  18. srbjsloggerA browser JavaScript logger whose log, warn and error calls write prominent output to the console, loaded into a UI5 app through index.html or the manifest's resources.from UI5
  19. abap-message-loggerMessage logger for ABAP Cloud that saves to the Application Logfrom ABAP

Details

Sources4
Added by handdiscovered herechecked
npm registry, openui5-error-collectorversion, releases, installschecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
latestv1.1.0
first release
releases and cadence4, ~11d median
discovered viaAdded by hand
first seen in the atlas
ecosystem and domainui5, developer-experience
History in the atlas1
  1. First seen.
For your agent
Ref
artifact:mauriciolauffer-openui5-error-collector
JSON
/artifacts/mauriciolauffer-openui5-error-collector.json
MCP
Connecting an agent