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

Error codes #74

Open
rightaway opened this issue Sep 7, 2021 · 3 comments
Open

Error codes #74

rightaway opened this issue Sep 7, 2021 · 3 comments

Comments

@rightaway
Copy link

Error messages like Socks4 Proxy rejected incoming bound connection - Failed could change and are concatenated from 2 different parts sometimes like ERRORS.Socks4ProxyRejectedIncomingBoundConnection and Socks4Response[data[1]]

this.closeSocket(

To do error handling we would need to do string manipulation on error.message which isn't reliable. It will be better if we could have error.code and error.detail property if the error has detail information in addition to human readable error.message.

/* with detail */
{
    code: "SOCKS4_REJECTED_INCOMING",
    detail: "Failure",
    message: "Socks4 Proxy rejected incoming bound connection - Failure"
}

/* without detail */
{
    code: "INTERNAL_ERROR",
    message: "SocksClient internal error (this should not happen)"
}
@JoshGlazebrook
Copy link
Owner

Seems reasonable, I'll try to get this done soon!

@rightaway
Copy link
Author

Could you also add a boolean property such as error.fatal whether the error can be retried or not? Some errors like server errors can be retried but others like client errors mean something is wrong in the configuration and retrying won't help until the problem is fixed. This property will make better error handling possible.

/* client */
{
    code: "INVALID_DESTINATION_HOST",
    message: "An invalid destination host was provided.",
    fatal: true
}

/* server */
{
    code: "SOCKS4_REJECTED_INCOMING",
    detail: "Failure",
    message: "Socks4 Proxy rejected incoming bound connection - Failure",
    fatal: false
}

Are some errors in https://github.com/JoshGlazebrook/socks/blob/master/src/common/constants.ts not being thrown? I see about half of them being used in https://github.com/JoshGlazebrook/socks/blob/master/src/client/socksclient.ts.

@rightaway
Copy link
Author

Seems reasonable, I'll try to get this done soon!

@JoshGlazebrook Do you think you would be able to add these?

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