caolan / caolan/nodeunit

Allow importing custom error types

Open
#246 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.9k
Forks
359
PR merge metrics
No merged PRs in 30d

Description

Hi,

I am using node unit and I defined custom error types in this fashion :

```
var errors = {}
errors.UnknownAttributeError = function(message) {
this.name = "UnknownAttributeError";
this.message = message || "UnknownAttributeError";
}
errors.UnknownAttributeError.prototype = new Error();
errors.UnknownAttributeError.prototype.constructor = errors.UnknownAttributeError;

module.exports = errors;
```

when I import the errors file as so :

```
var Errors = require('./../../lib/relational/errors');
```

The `new Error()` is caught and raised, but I think it should not be...

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.