[go: nahoru, domu]

Skip to content

Commit

Permalink
Use new when constructing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
juanjoDiaz committed Nov 24, 2018
1 parent cffb42e commit d3ed883
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/decoders/hextile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ")");
}

Expand Down
12 changes: 6 additions & 6 deletions core/decoders/tight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 + ")");
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 + ")");
}

Expand Down Expand Up @@ -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");
}
}

Expand Down Expand Up @@ -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");
}
}

Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion core/decoders/tightpng.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
4 changes: 2 additions & 2 deletions core/rfb.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d3ed883

Please sign in to comment.