aboutsummaryrefslogtreecommitdiff
path: root/vendor/gopkg.in/gorp.v1/errors.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in/gorp.v1/errors.go')
-rw-r--r--vendor/gopkg.in/gorp.v1/errors.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/gopkg.in/gorp.v1/errors.go b/vendor/gopkg.in/gorp.v1/errors.go
new file mode 100644
index 0000000..356d684
--- /dev/null
+++ b/vendor/gopkg.in/gorp.v1/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
+ }
+}