Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuxt-testevia

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-testevia - npm Package Compare versions

Comparing version 1.0.1 to 1.0.3

src/error-handler.js

2

package.json
{
"name": "nuxt-testevia",
"version": "1.0.1",
"version": "1.0.3",
"description": "Nuxt - Testevia Logger",

@@ -5,0 +5,0 @@ "license": "MIT",

const path = require('path')
const errorHandler = require('./error-handler.js').default

@@ -7,4 +8,9 @@ module.exports = function(options) {

src: path.resolve(__dirname, 'plugin.js'),
options
})
options: {
...options,
errorHandler: path.resolve(__dirname, './error-handler.js')
}
});
this.nuxt.hook('render:errorMiddleware', app => app.use(errorHandler.errorHandler(options)))
}

@@ -11,0 +17,0 @@

import Vue from 'vue'
import axios from 'axios'
import errorHandler from <%= serialize(options.errorHandler) %>;
class Testevia{
constructor({settings, context}){
this.project = settings.project;
this.sendingEnabled = !context.isDev || settings.dev;
this.context = context;
this.config = {
headers: {'Authorization': settings.apiKey}
};
this.init()
}
init(){
Vue.config.errorHandler = (err) => {
if(this.sendingEnabled) this.sendError(err)
export default (context, inject) =>{
let options = <%= serialize(options) %>;
Vue.config.errorHandler = (err) => {
if(!context.isDev || options.dev){
errorHandler.sendError(process.server ? context.route.fullPath : window.location.href, err, options);
}
}
sendError(err){
let context = {
project: this.project,
source: 'frontend',
data: {
url: process.server ? this.context.route.fullPath : window.location.href
},
}
if(err.message) context.data['error_message'] = err.message;
if(err.stack) context.data['stacktrace'] = err.stack;
axios.post('https://testevia.broj42.com/api/log-errors/', context, this.config)
.catch(e =>{
// console.dir(e)
});
}
}
export default (context, inject) =>{
let testevia = new Testevia({
settings: {
...<%= serialize(options) %>
},
context
});
inject('sendError', (err) => testevia.sendError(err))
inject('sendError', (err, options) => errorHandler.sendError(err, options))
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc