Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce / clean up ErrorKinds #2635

Closed
ry opened this issue Jul 11, 2019 · 2 comments
Closed

Reduce / clean up ErrorKinds #2635

ry opened this issue Jul 11, 2019 · 2 comments

Comments

@ry
Copy link
Member

ry commented Jul 11, 2019

deno/cli/msg.fbs

Lines 87 to 146 in 963d56f

enum ErrorKind: byte {
NoError = 0,
// io errors
NotFound,
PermissionDenied,
ConnectionRefused,
ConnectionReset,
ConnectionAborted,
NotConnected,
AddrInUse,
AddrNotAvailable,
BrokenPipe,
AlreadyExists,
WouldBlock,
InvalidInput,
InvalidData,
InvalidPath,
TimedOut,
Interrupted,
WriteZero,
Other,
UnexpectedEof,
BadResource,
CommandFailed,
// url errors
EmptyHost,
IdnaError,
InvalidPort,
InvalidIpv4Address,
InvalidIpv6Address,
InvalidDomainCharacter,
RelativeUrlWithoutBase,
RelativeUrlWithCannotBeABaseBase,
SetHostOnCannotBeABaseUrl,
Overflow,
// hyper errors
HttpUser,
HttpClosed,
HttpCanceled,
HttpParse,
HttpOther,
TooLarge,
// custom errors
InvalidUri,
InvalidSeekMode,
OpNotAvailable,
WorkerInitFailed,
UnixError,
NoAsyncSupport,
NoSyncSupport,
ImportMapError,
ImportPrefixMissing,
DenoDirError,

Before releasing v1.0 we should clean up this struct as much as possible.

for comparison here are the linux errnos http://man7.org/linux/man-pages/man3/errno.3.html

@bartlomieju
Copy link
Member

@ry do we consider this issue resolved now that #3662, #3936 and #4058 landed?

@bartlomieju
Copy link
Member

Number of ErrorKinds had been reduced significantly (

deno/cli/op_error.rs

Lines 33 to 60 in a29343c

// Warning! The values in this enum are duplicated in js/errors.ts
// Update carefully!
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum ErrorKind {
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,
/// This maps to window.Error - ie. a generic error type
/// if no better context is available.
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
Other = 22,
}
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants