From c0383dff6b55113341fca49e7be767d7ec3cc5cf Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Fri, 12 Jun 2015 21:33:16 +0200 Subject: [PATCH] Adds IsType() helper --- errors.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/errors.go b/errors.go index 8f29391a..9d59552f 100644 --- a/errors.go +++ b/errors.go @@ -76,6 +76,10 @@ func (msg *Error) Error() string { return msg.Err.Error() } +func (msg *Error) IsType(flags ErrorType) bool { + return (msg.Type & flags) > 0 +} + // Returns a readonly copy filterd the byte. // ie ByType(gin.ErrorTypePublic) returns a slice of errors with type=ErrorTypePublic func (a errorMsgs) ByType(typ ErrorType) errorMsgs {