Add a generic error type to capture non-typed errors

Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
This commit is contained in:
Richard Scothern
2015-11-02 13:23:53 -08:00
parent 9637cb40cd
commit bc6e4cdceb
10 changed files with 44 additions and 29 deletions

View File

@@ -131,3 +131,14 @@ type InvalidOffsetError struct {
func (err InvalidOffsetError) Error() string {
return fmt.Sprintf("[%s] Invalid offset: %d for path: %s", err.DriverName, err.Offset, err.Path)
}
// Error is a catch-all error type which captures an error string and
// the driver type on which it occured.
type Error struct {
DriverName string
Enclosed error
}
func (err Error) Error() string {
return fmt.Sprintf("[%s] %s", err.DriverName, err.Enclosed)
}