Merge pull request #809 from abperiasamy/ret-untrace

return *probe.Error for Untrace() as well.
This commit is contained in:
Anand Babu (AB) Periasamy 2015-08-24 03:43:13 -07:00
commit 2f260adc69
1 changed files with 4 additions and 3 deletions

View File

@ -108,18 +108,19 @@ func (e *Error) trace(fields ...string) *Error {
}
// Untrace erases last trace entry.
func (e *Error) Untrace() {
func (e *Error) Untrace() *Error {
if e == nil {
return
return nil
}
e.lock.Lock()
defer e.lock.Unlock()
l := len(e.CallTrace)
if l == 0 {
return
return nil
}
e.CallTrace = e.CallTrace[:l-1]
return e
}
// ToGoError returns original error message.