Commit 56bf8f81 authored by Kirill Smelkov's avatar Kirill Smelkov

*: Add Unwrap to custom errors that have Cause

So that Go1.13 and golang.org/x/xerrors understand the wrapping:
https://blog.golang.org/go1.13-errors

Preserve Cause for compatibility with github.com/pkg/errors.
parent 515a6d14
// Copyright (C) 2018 Nexedi SA and Contributors. // Copyright (C) 2018-2020 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your // it under the terms of the GNU General Public License version 3, or (at your
...@@ -196,6 +196,5 @@ func (e *RegistryError) Error() string { ...@@ -196,6 +196,5 @@ func (e *RegistryError) Error() string {
return s return s
} }
func (e *RegistryError) Cause() error { func (e *RegistryError) Cause() error { return e.Err }
return e.Err func (e *RegistryError) Unwrap() error { return e.Err }
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment