in refcount.go [86:100]
func (c *RefCount) Fail(err error) bool {
// use dummy function to handle the error, ensuring errMux.Unlock will be
// executed before the call to Release or in case OnError panics.
func() {
c.errMux.Lock()
defer c.errMux.Unlock()
if c.OnError != nil {
c.err = c.OnError(c.err, err)
} else if c.err == nil {
c.err = err
}
}()
return c.Release()
}