Skip to content

Pygocentrus/sioux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sioux.js

Sioux image

Introduction

Sioux is a simple bug watcher logging the exceptions that occur in your client's front app directly into your backend. Thus, you can take care of those issues, sending them to your developers by email, but also use some hooks of your own, as adding them to your Agile board, to only name a few.

What you'll receive in the server-side

  • message: The error message. Basically.
  • file: The target file where the bug has been found.
  • line: The error's line number, only making sense when the script is not minified.
  • column: The column's number.
  • date: The date when the errors happened.
  • ismobile: Whether it happened on a mobile device.
  • isretina: Whether the device is retina.
  • os: The operating system on which the error was thrown.
  • browser: The target browser.
  • version: The browser's version.
  • language: The browser's main language.
  • resolution: The browser's resolution (widthxheight).
  • orientation: The browser's orientation.
  • url: The URL where the error happened.

How to settle it

var options = {
  serverUrl: "http://domain.tld/errors",
  method: "POST",
  maxRequests: 10,
  token: {
    'key':'X-CSRF-Token',
    'value': document.querySelector('meta[name="csrf-token"]').content
  },
  shouldLog: true,
  cb: function (serverResponse) {
    console.info(serverResponse);
  }
};

new Sioux(options).watch();

// Now we throw a dumb exception
console.log(new UnknownObject());

Available parameters

  • serverUrl: Your server-side error API route.
  • method: The method to apply, default to POST.
  • maxRequests: The maximum number of error logs to send, avoiding spam.
  • token: If you have a CSRF token to add to the request's header, that's here.
  • shouldLog: Whether of not it should log the requests in the front-end console. Default to false.
  • cb: The callback function to run when we get an answer from the server.

Example

Take a look at the /example folder where you will find a basic Ruby on Rails app that uses the library. It will raise an error in front, log its parameters in backend and send back a json.
How to try it:
$ cd example
$ gem install
$ rails s
From this point, you can do whatever you want with those errors. For instance you can send an email, add a Trello card, a Github issue, use IFTTT to use thousand of hooks, actually the only limit is your imagination!

Credits

Special thanks to Simon Child for the visual.

About

Simple bug watcher, logging your frontend errors in your backend API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors