summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2018-11-26 18:36:10 +0100
committerGitHub <noreply@github.com>2018-11-26 18:36:10 +0100
commitae1f7a8f5cc480afa471ff66a1211b8eb51129ee (patch)
tree9f23dfbd472dd392979419e905c09a26eb42b2cc
parentcffb42ee8f150d46b6ecf2727fadd0f4f6557aa8 (diff)
parentd3ed883a8fc1dc15d2d7082f70bb2695e844ae90 (diff)
downloadnovnc-ae1f7a8f5cc480afa471ff66a1211b8eb51129ee.tar.gz
Merge pull request #1168 from juanjoDiaz/use_new_error
Use `new` when constructing errors
-rw-r--r--core/decoders/hextile.js2
-rw-r--r--core/decoders/tight.js12
-rw-r--r--core/decoders/tightpng.js2
-rw-r--r--core/rfb.js4
4 files changed, 10 insertions, 10 deletions
diff --git a/core/decoders/hextile.js b/core/decoders/hextile.js
index 91141aa..04336df 100644
--- a/core/decoders/hextile.js
+++ b/core/decoders/hextile.js
@@ -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 + ")");
}
diff --git a/core/decoders/tight.js b/core/decoders/tight.js
index 58c23a6..5a76017 100644
--- a/core/decoders/tight.js
+++ b/core/decoders/tight.js
@@ -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) {
diff --git a/core/decoders/tightpng.js b/core/decoders/tightpng.js
index 2d91746..7bbde3a 100644
--- a/core/decoders/tightpng.js
+++ b/core/decoders/tightpng.js
@@ -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");
}
}
diff --git a/core/rfb.js b/core/rfb.js
index ffdd9c0..9f47c47 100644
--- a/core/rfb.js
+++ b/core/rfb.js
@@ -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();