Merge pull request #244 from humphd/better-errors
Fix crash in src/errors.js, see https://github.com/mozilla/makedrive/issues/145
This commit is contained in:
commit
e9eae3549b
|
@ -77,16 +77,17 @@ var errors = {};
|
||||||
err = e[1],
|
err = e[1],
|
||||||
message = e[2];
|
message = e[2];
|
||||||
|
|
||||||
function ctor(m) {
|
function FilerError(m) {
|
||||||
|
this.name = err;
|
||||||
|
this.code = err;
|
||||||
|
this.errno = errno;
|
||||||
this.message = m || message;
|
this.message = m || message;
|
||||||
}
|
}
|
||||||
var proto = ctor.prototype = new Error();
|
FilerError.prototype = Object.create(Error.prototype);
|
||||||
proto.errno = errno;
|
FilerError.prototype.constructor = FilerError;
|
||||||
proto.code = err;
|
|
||||||
proto.constructor = ctor;
|
|
||||||
|
|
||||||
// We expose the error as both Errors.EINVAL and Errors[18]
|
// We expose the error as both Errors.EINVAL and Errors[18]
|
||||||
errors[err] = errors[errno] = ctor;
|
errors[err] = errors[errno] = FilerError;
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = errors;
|
module.exports = errors;
|
||||||
|
|
Loading…
Reference in New Issue