@iotechpis/ioreporter
ioReporter is a IOTech utility that sends messages to ioChat whenever a error happens in front-end or back-end (only logical/bad programming errors, not user errors).
Last updated 9 months ago by iodevteam .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @iotechpis/ioreporter 
SYNC missed versions from official npm registry.

ioReporter

About

ioReporter is a IOTech utility that sends messages to ioChat whenever a error happens in front-end or back-end (only logical/bad programming errors, not user errors).

Install

npm i @iotechpis/ioreporter -s

How to use

Back-end (Nodejs & Express)

const express =  require("express");
const app =  express();

//URL where you want to send the error message (you must ask for this)
const webhook_url = "https://webhook.com/weognrwg"; 

//Channel name in the chat
const api_channel = "ioreporter_api";
const app_channel = "ioreporter_app";

//Error message that the server provides everytime a HTTP request results in an error
//If no error_message is provided, this is also the default one
const error_message = {
	http:  500,
	code:  "ServerError",
	type:  "error"
};

require("@iotechpis/ioreporter")(app, webhook_url, api_channel, app_channel, error_message);

This automatically creates an endpoint /ioreporter/error (POST) , that can be used to report front-end errors, if no app_channel is provided, the endpoint is not created.

Front-end (Vuejs)

App.vue

import { sendError } from  "./api/apiError";
export  default {
	created() {
		window.onerror  =  function  myErrorHandler(errorMsg, url, lineNumber) {
			sendError({
				error: errorMsg,
				url,
				line: lineNumber
			});
			return;
		};
	}
}

/api/apiError.js

import { post } from  "../utils/http"

export  function  sendError(data) {
	return  post('/ioreporter/error', data)
}

Current Tags

  • 1.0.5                                ...           latest (9 months ago)

6 Versions

  • 1.0.5                                ...           9 months ago
  • 1.0.4                                ...           9 months ago
  • 1.0.3                                ...           9 months ago
  • 1.0.2                                ...           9 months ago
  • 1.0.1                                ...           9 months ago
  • 1.0.0                                ...           9 months ago
Downloads
Today 0
This Week 6
This Month 8
Last Day 0
Last Week 1
Last Month 1
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |