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

Method LastError

nats.go:4151–4159  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

4149// It can be used reliably within ClosedCB in order to find out reason
4150// why connection was closed for example.
4151func (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

Callers 15

TestMaxPendingOutFunction · 0.45
TestLastErrorNoRaceFunction · 0.45
TestCustomFlusherTimeoutFunction · 0.45
TestEncBuiltinMarshalIntFunction · 0.45

Calls

no outgoing calls

Tested by 15

TestMaxPendingOutFunction · 0.36
TestLastErrorNoRaceFunction · 0.36
TestCustomFlusherTimeoutFunction · 0.36
TestEncBuiltinMarshalIntFunction · 0.36