Skip to content

Commit

Permalink
Merge pull request #88 from grafana/fix/remove-node-dependency-from-lib
Browse files Browse the repository at this point in the history
[fix] remove verror dependency from lib code
  • Loading branch information
EdvinasDaugirdas authored Dec 1, 2021
2 parents e4fd8a1 + 7c96718 commit 8ad315a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bin/har-to-k6.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const convert = require('../src/convert')
const fs = require('fs')
const io = require('caporal')
const pkginfo = require('pkginfo')
const { HarToK6Error } = require('../src/error')
const { DEFAULT_CLI_OPTIONS } = require('../src/constants')
const { VError } = require('verror')

class CommandLineError extends HarToK6Error {}
class CommandLineError extends VError {}

pkginfo(module, 'version')
const version = module.exports.version
Expand Down
11 changes: 9 additions & 2 deletions src/error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
const { VError } = require('verror')
class HarToK6Error extends Error {
constructor(details, message) {
super(typeof details === 'string' ? details : message)

if (typeof details === 'object') {
Object.assign(this, details)
}
}
}

class HarToK6Error extends VError {}
class InvalidArchiveError extends HarToK6Error {}
class UnrecognizedError extends HarToK6Error {}

Expand Down

0 comments on commit 8ad315a

Please sign in to comment.