]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Use `new` when constructing errors
authorJuanjo Diaz <juanjo.diazmo@gmail.com>
Sat, 24 Nov 2018 19:44:11 +0000 (21:44 +0200)
committerJuanjo Diaz <juanjo.diazmo@gmail.com>
Sat, 24 Nov 2018 19:44:11 +0000 (21:44 +0200)
core/decoders/hextile.js
core/decoders/tight.js
core/decoders/tightpng.js
core/rfb.js

index 91141aa4b39aa9db11bae5968c6fda3153573a72..04336dfa5872ce6a6dd36ca2c69687df8cbc68e7 100644 (file)
@@ -37,7 +37,7 @@ export default class HextileDecoder {
 
             let subencoding = rQ[rQi];  // Peek
             if (subencoding > 30) {  // Raw
-                throw Error("Illegal hextile subencoding (subencoding: " +
+                throw new Error("Illegal hextile subencoding (subencoding: " +
                             subencoding + ")");
             }
 
index 58c23a6ef99fbe1164bc843336e6abc388f2a8f6..5a76017f07f9a2f236571c9c64372ed3bbd20af8 100644 (file)
@@ -62,7 +62,7 @@ export default class TightDecoder {
             ret = this._basicRect(this._ctl, x, y, width, height,
                                   sock, display, depth);
         } else {
-            throw Error("Illegal tight compression received (ctl: " +
+            throw new Error("Illegal tight compression received (ctl: " +
                                    this._ctl + ")");
         }
 
@@ -100,7 +100,7 @@ export default class TightDecoder {
     }
 
     _pngRect(x, y, width, height, sock, display, depth) {
-        throw Error("PNG received in standard Tight rect");
+        throw new Error("PNG received in standard Tight rect");
     }
 
     _basicRect(ctl, x, y, width, height, sock, display, depth) {
@@ -135,7 +135,7 @@ export default class TightDecoder {
                                            sock, display, depth);
                 break;
             default:
-                throw Error("Illegal tight filter received (ctl: " +
+                throw new Error("Illegal tight filter received (ctl: " +
                                        this._filter + ")");
         }
 
@@ -164,7 +164,7 @@ export default class TightDecoder {
 
             data = this._zlibs[streamId].inflate(data, true, uncompressedSize);
             if (data.length != uncompressedSize) {
-                throw Error("Incomplete zlib block");
+                throw new Error("Incomplete zlib block");
             }
         }
 
@@ -212,7 +212,7 @@ export default class TightDecoder {
 
             data = this._zlibs[streamId].inflate(data, true, uncompressedSize);
             if (data.length != uncompressedSize) {
-                throw Error("Incomplete zlib block");
+                throw new Error("Incomplete zlib block");
             }
         }
 
@@ -277,7 +277,7 @@ export default class TightDecoder {
     }
 
     _gradientFilter(streamId, x, y, width, height, sock, display, depth) {
-        throw Error("Gradient filter not implemented");
+        throw new Error("Gradient filter not implemented");
     }
 
     _readData(sock) {
index 2d91746cf6eacab583e0201359bb8498d8beef32..7bbde3a43b58d5a469e59d4b47e0d61f49043cb2 100644 (file)
@@ -24,6 +24,6 @@ export default class TightPNGDecoder extends TightDecoder {
     }
 
     _basicRect(ctl, x, y, width, height, sock, display, depth) {
-        throw Error("BasicCompression received in TightPNG rect");
+        throw new Error("BasicCompression received in TightPNG rect");
     }
 }
index ffdd9c046ad6f0f11824dbc13293db008166e5d0..9f47c4706179c30a82e6db5332bbd5bff40a27c6 100644 (file)
@@ -35,10 +35,10 @@ const DISCONNECT_TIMEOUT = 3;
 export default class RFB extends EventTargetMixin {
     constructor(target, url, options) {
         if (!target) {
-            throw Error("Must specify target");
+            throw new Error("Must specify target");
         }
         if (!url) {
-            throw Error("Must specify URL");
+            throw new Error("Must specify URL");
         }
 
         super();