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

Make Keberos result codes available from errors #440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lorenz
Copy link

@lorenz lorenz commented May 14, 2021

This exposes inner errors in Krberror errors as a non-breaking change by making Krberror implement the Unwrap interface.

Example:

err := client.Login()
var krbErr messages.KRBError
if errors.As(err, &krbErr) {
    switch krbErr.ErrorCode {
        case errorcode.KDC_ERR_PREAUTH_FAILED:
            fmt.Println("This is a PREAUTH_FAILED error")
        }
}

Fixes #437

Copy link
Owner

@jcmturner jcmturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without updating the Add method we don't capture the inner errors in all cases. krberror was written before Go implemented error wrapping. I'm thinking that the Add interface will have to change to implement the way Go wraps errors. This would therefore need a major version iteration.

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

Successfully merging this pull request may close these issues.

Krberror hides original error
2 participants