diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-08-07 22:47:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-07 16:47:18 -0400 |
commit | 59ca66a207ceb4699e1322ce22f953ac0f124f13 (patch) | |
tree | 775b30b9a46f3c824d97060fb147336ecb6b83b7 /cli/tsc/01_errors.js | |
parent | 479164d287604d079f6342e656f2ac95b109367f (diff) |
Encode op errors as strings instead of numbers (#6977)
Diffstat (limited to 'cli/tsc/01_errors.js')
-rw-r--r-- | cli/tsc/01_errors.js | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/cli/tsc/01_errors.js b/cli/tsc/01_errors.js index 8390dd803..fb2bb78c2 100644 --- a/cli/tsc/01_errors.js +++ b/cli/tsc/01_errors.js @@ -1,101 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. ((window) => { - // Warning! The values in this enum are duplicated in cli/op_error.rs - // Update carefully! - const ErrorKind = { - 1: "NotFound", - 2: "PermissionDenied", - 3: "ConnectionRefused", - 4: "ConnectionReset", - 5: "ConnectionAborted", - 6: "NotConnected", - 7: "AddrInUse", - 8: "AddrNotAvailable", - 9: "BrokenPipe", - 10: "AlreadyExists", - 13: "InvalidData", - 14: "TimedOut", - 15: "Interrupted", - 16: "WriteZero", - 17: "UnexpectedEof", - 18: "BadResource", - 19: "Http", - 20: "URIError", - 21: "TypeError", - 22: "Other", - 23: "Busy", - - NotFound: 1, - PermissionDenied: 2, - ConnectionRefused: 3, - ConnectionReset: 4, - ConnectionAborted: 5, - NotConnected: 6, - AddrInUse: 7, - AddrNotAvailable: 8, - BrokenPipe: 9, - AlreadyExists: 10, - InvalidData: 13, - TimedOut: 14, - Interrupted: 15, - WriteZero: 16, - UnexpectedEof: 17, - BadResource: 18, - Http: 19, - URIError: 20, - TypeError: 21, - Other: 22, - Busy: 23, - }; - - function getErrorClass(kind) { - switch (kind) { - case ErrorKind.TypeError: - return TypeError; - case ErrorKind.Other: - return Error; - case ErrorKind.URIError: - return URIError; - case ErrorKind.NotFound: - return NotFound; - case ErrorKind.PermissionDenied: - return PermissionDenied; - case ErrorKind.ConnectionRefused: - return ConnectionRefused; - case ErrorKind.ConnectionReset: - return ConnectionReset; - case ErrorKind.ConnectionAborted: - return ConnectionAborted; - case ErrorKind.NotConnected: - return NotConnected; - case ErrorKind.AddrInUse: - return AddrInUse; - case ErrorKind.AddrNotAvailable: - return AddrNotAvailable; - case ErrorKind.BrokenPipe: - return BrokenPipe; - case ErrorKind.AlreadyExists: - return AlreadyExists; - case ErrorKind.InvalidData: - return InvalidData; - case ErrorKind.TimedOut: - return TimedOut; - case ErrorKind.Interrupted: - return Interrupted; - case ErrorKind.WriteZero: - return WriteZero; - case ErrorKind.UnexpectedEof: - return UnexpectedEof; - case ErrorKind.BadResource: - return BadResource; - case ErrorKind.Http: - return Http; - case ErrorKind.Busy: - return Busy; - } - } - class NotFound extends Error { constructor(msg) { super(msg); @@ -245,6 +150,5 @@ window.__bootstrap.errors = { errors, - getErrorClass, }; })(this); |