Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions test/fixtures/internal-error.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
'use strict';
const NestedError = require('nested-error-stacks');
const util = require('util');

function InternalError(message, nested) {
NestedError.call(this, message, nested);
}
class InternalError extends NestedError {}

util.inherits(InternalError, NestedError);
InternalError.prototype.name = 'InternalError';

module.exports = function (cb, err) {
Expand Down
20 changes: 10 additions & 10 deletions test/fixtures/nested-errors.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

const NestedError = require('nested-error-stacks');
const util = require('util');
const internal = require('./internal-error');


function foo(cb) {
bar(function nested(err) {
cb(new FooError(`foo${err.message}`, err));
Expand All @@ -16,20 +16,20 @@ function bar(cb) {
});
}

function FooError(message, nested) {
NestedError.call(this, message, nested);
}

util.inherits(FooError, NestedError);
class FooError extends NestedError {}
FooError.prototype.name = 'FooError';

function BarError(message, nested) {
NestedError.call(this, message, nested);
}

util.inherits(BarError, NestedError);



class BarError extends NestedError {}
BarError.prototype.name = 'BarError';





module.exports.top = function(cb) {
internal(function (err) {
cb(err.stack);
Expand Down