Browse Source

Expose POSIX error name as PosixError.code

This matches the behaviour of Node.JS's errors, and some libraries
expect it.
Sam Atkins 1 year ago
parent
commit
c08c8bd073
1 changed files with 1 additions and 0 deletions
  1. 1 0
      packages/puter-js-common/src/PosixError.js

+ 1 - 0
packages/puter-js-common/src/PosixError.js

@@ -89,6 +89,7 @@ class PosixError extends Error {
 
         super(message ?? ErrorMetadata.get(posixCode).description);
         this.posixCode = posixCode;
+        this.code = posixCode.description;
     }
 
     static fromNodeJSError(e) {