LastError reports the last error encountered via the connection. It can be used reliably within ClosedCB in order to find out reason why connection was closed for example.
()
| 4149 | // It can be used reliably within ClosedCB in order to find out reason |
| 4150 | // why connection was closed for example. |
| 4151 | func (nc *Conn) LastError() error { |
| 4152 | if nc == nil { |
| 4153 | return ErrInvalidConnection |
| 4154 | } |
| 4155 | nc.mu.RLock() |
| 4156 | err := nc.err |
| 4157 | nc.mu.RUnlock() |
| 4158 | return err |
| 4159 | } |
| 4160 | |
| 4161 | // Check if the given error string is an auth error, and if so returns |
| 4162 | // the corresponding ErrXXX error, nil otherwise |
no outgoing calls