ErrorBoard – Track JS errors in a clean interface for yourself with node.js

Javascript Error tracking is becoming more and more important, with applications moving to the client. Many service providers already offer a variety of extensive error tracking solutions for a price. These providers help to get around browser limitations and get the most out of errors.

Depending on your budget, that might not always be an option and not always needed.

To the rescue comes ErrorBoard, that provides a basic interface to track window.onerror events. Requires Node.js, NPM and a free port.

Here the window.onerror,  how I set it up for now:

  1. // checks if there was a previously defined window.onerror and preserve it
  2. var oldOnError = window.onerror;
  3.  
  4. window.onerror = function( message, url, line, column, error ) {
  5.  
  6.  
  7.   if (errorMsg.indexOf('Script error.') > -1) {
  8.    return false;
  9.   }
  10.  
  11.   try {
  12.         var e = encodeURIComponent;
  13.        
  14.         var meta = '{"project":"portalzine.de"}';
  15.        
  16.         ( new Image() ).src = 'http://UrltoErrorBoard/error?message=' + e( message ) +
  17.         '&url='         + e( url ) +
  18.         '&line='        + e( line ) +
  19.         '&meta='                + e( meta ) +
  20.         ( error && error.stack ? '&stack='      + e( error.stack ) : '' ) +
  21.         ( column ? '&column='  + e( column ) : '' )
  22.         ;
  23.  
  24.   } catch(e) {
  25.         // we don't want errors to throw inside onerror
  26.   }
  27.  
  28.   // Call any previously assigned handler
  29.   if (typeof oldOnError === 'function') {
  30.         oldOnError.apply(this, arguments);
  31.   }
  32.  
  33.   // returning false triggers the execution of the built-in error handler                                                              
  34.   return false;
  35. };

Enjoy coding …

Alex

I am a full-stack developer. I love programming,  design and know my way around server architecture as well.  I would never feel complete, with one of these missing. I have a broad range of interests, that’s why I constantly dive into new technologies and expand my knowledge where ever required. Technologies are evolving fast and I enjoy using the latest. Apart from that, I am a peace loving guy who tries to have people around him that think the same.  I truly believe in the principle: “If you help someone, someone will help you, when you need it."

Recent Posts

Particle Network Animations in Javascript

What are particle animations? Particle network animations in JavaScript typically involve creating visual representations of… Read More

4 days ago

B&B / Hotel Booking Solutions for WordPress | 2024

BOOKING SOLUTIONS 202x This is my take on a subset of booking, appointment, PMS or… Read More

1 month ago

WordPress Cron + WP-CLI + Ntfy

THE GOAL Create a system cron for WordPress, that is accessible and can be easily… Read More

3 months ago

2024 is here and now :)

2024, what's cooking? Slowly getting into the 2024 spirit. 3 projects coming to a close… Read More

4 months ago

2023 ends and whats next !

Short look back at 2023 This has been a busy and interesting year. I am… Read More

4 months ago

cubicFUSION Grid Tweaker – Elementor Grid made easy.

Elementor Pro provides grid containers as an experimental feature. The options provided are limited, when… Read More

5 months ago