aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnthony Pesch <inolen@gmail.com>2013-08-13 17:34:24 -0700
committerAnthony Pesch <inolen@gmail.com>2013-08-13 17:34:24 -0700
commit3b871e28f328c45835f75d29e790bfc808f2f002 (patch)
tree52770c0bc2d2705f09e3f279ba86f950233199cd /src
parentb639ed59378df54fc0513fb00ac97d0678f8ee6e (diff)
make FS.ErrnoError inherit from Error
Diffstat (limited to 'src')
-rw-r--r--src/library_fs.js23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/library_fs.js b/src/library_fs.js
index 9c83fcad..f18e4809 100644
--- a/src/library_fs.js
+++ b/src/library_fs.js
@@ -27,16 +27,21 @@ mergeInto(LibraryManager.library, {
// to modify the filesystem freely before run() is called.
ignorePermissions: true,
- ErrnoError: function(errno) {
- this.errno = errno;
- for (var key in ERRNO_CODES) {
- if (ERRNO_CODES[key] === errno) {
- this.code = key;
- break;
+ ErrnoError: (function() {
+ function ErrnoError(errno) {
+ this.errno = errno;
+ for (var key in ERRNO_CODES) {
+ if (ERRNO_CODES[key] === errno) {
+ this.code = key;
+ break;
+ }
}
- }
- this.message = ERRNO_MESSAGES[errno] + ' : ' + new Error().stack;
- },
+ this.message = ERRNO_MESSAGES[errno];
+ };
+ ErrnoError.prototype = new Error();
+ ErrnoError.prototype.constructor = ErrnoError;
+ return ErrnoError;
+ }()),
handleFSError: function(e) {
if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + new Error().stack;