From 56e74239d6b34df8f30ef046f0b0ff4ff0866a71 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sun, 14 Jun 2015 23:53:32 -0800 Subject: first commit --- .../src/github.com/go-gorp/gorp/errors.go | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Godeps/_workspace/src/github.com/go-gorp/gorp/errors.go (limited to 'Godeps/_workspace/src/github.com/go-gorp/gorp/errors.go') diff --git a/Godeps/_workspace/src/github.com/go-gorp/gorp/errors.go b/Godeps/_workspace/src/github.com/go-gorp/gorp/errors.go new file mode 100644 index 000000000..356d68475 --- /dev/null +++ b/Godeps/_workspace/src/github.com/go-gorp/gorp/errors.go @@ -0,0 +1,26 @@ +package gorp + +import ( + "fmt" +) + +// A non-fatal error, when a select query returns columns that do not exist +// as fields in the struct it is being mapped to +type NoFieldInTypeError struct { + TypeName string + MissingColNames []string +} + +func (err *NoFieldInTypeError) Error() string { + return fmt.Sprintf("gorp: No fields %+v in type %s", err.MissingColNames, err.TypeName) +} + +// returns true if the error is non-fatal (ie, we shouldn't immediately return) +func NonFatalError(err error) bool { + switch err.(type) { + case *NoFieldInTypeError: + return true + default: + return false + } +} -- cgit v1.2.3-1-g7c22