MCPcopy
hub / github.com/nats-io/nats.go / checkAuthError

Function checkAuthError

nats.go:4163–4177  ·  view source on GitHub ↗

Check if the given error string is an auth error, and if so returns the corresponding ErrXXX error, nil otherwise

(e string)

Source from the content-addressed store, hash-verified

4161// Check if the given error string is an auth error, and if so returns
4162// the corresponding ErrXXX error, nil otherwise
4163func checkAuthError(e string) error {
4164 if strings.HasPrefix(e, AUTHORIZATION_ERR) {
4165 return ErrAuthorization
4166 }
4167 if strings.HasPrefix(e, AUTHENTICATION_EXPIRED_ERR) {
4168 return ErrAuthExpired
4169 }
4170 if strings.HasPrefix(e, AUTHENTICATION_REVOKED_ERR) {
4171 return ErrAuthRevoked
4172 }
4173 if strings.HasPrefix(e, ACCOUNT_AUTHENTICATION_EXPIRED_ERR) {
4174 return ErrAccountAuthExpired
4175 }
4176 return nil
4177}
4178
4179// processErr processes any error messages from the server and
4180// sets the connection's LastError.

Callers 2

sendConnectMethod · 0.85
processErrMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected