Skip to content

Commit

Permalink
remove useless ErrNotImplemented (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lagovas authored and vixentael committed Nov 12, 2018
1 parent d09718f commit a21628f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
9 changes: 4 additions & 5 deletions acra-censor/handlers/blacklist_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,16 @@ func (handler *BlacklistHandler) CheckQuery(query string) (bool, error) {
handler.logger.WithField(logging.FieldKeyEventCode, logging.EventCodeErrorCensorQueryIsNotAllowed).WithError(ErrAccessToForbiddenTableBlacklist).Errorln("Query has been blocked by blacklist [tables]")
return false, ErrAccessToForbiddenTableBlacklist
}
case *sqlparser.Update:
return false, ErrNotImplemented

default:
return false, ErrNotImplemented
}
}
//Check patterns
if len(handler.patterns) != 0 {
matchingOccurred, err := checkPatternsMatching(handler.patterns, query)
if err != nil {
handler.logger.WithError(err).Debugln("Error from BlacklistHandler [patterns]")
if err == ErrQuerySyntaxError {
return false, ErrQuerySyntaxError
}
return false, ErrPatternCheckError
}
if matchingOccurred {
Expand Down
3 changes: 0 additions & 3 deletions acra-censor/handlers/handlers_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ var (
ErrAccessToForbiddenTableWhitelist = errors.New("query tries to access forbidden table")
ErrBlacklistPatternMatch = errors.New("query's structure is forbidden")
ErrWhitelistPatternMismatch = errors.New("query's structure is forbidden")
ErrNotImplemented = errors.New("not implemented yet")
ErrPatternSyntaxError = errors.New("fail to parse specified pattern")
ErrPatternCheckError = errors.New("failed to check specified pattern match")
ErrQuerySyntaxError = errors.New("fail to parse specified query")
ErrComplexSerializationError = errors.New("can't perform complex serialization of queries")
ErrSingleQueryCaptureError = errors.New("can't capture single query")
ErrCantOpenFileError = errors.New("can't open file to write queries")
ErrCantReadQueriesFromFileError = errors.New("can't read queries from file")
ErrUnexpectedCaptureChannelClose = errors.New("unexpected channel closing while query logging")
ErrUnexpectedTypeError = errors.New("should never appear")
)

Expand Down
5 changes: 3 additions & 2 deletions acra-censor/handlers/whitelist_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ func (handler *WhitelistHandler) CheckQuery(query string) (bool, error) {
handler.logger.WithField(logging.FieldKeyEventCode, logging.EventCodeErrorCensorQueryIsNotAllowed).WithError(ErrAccessToForbiddenTableWhitelist).Errorln("Query has been blocked by whitelist [tables]")
return false, ErrAccessToForbiddenTableWhitelist
}
case *sqlparser.Update:
return false, ErrNotImplemented
}
}
//Check patterns
if len(handler.patterns) != 0 {
matchingOccurred, err := checkPatternsMatching(handler.patterns, query)
if err != nil {
handler.logger.WithError(err).Debugln("Error from WhitelistHandler [patterns]")
if err == ErrQuerySyntaxError {
return false, ErrQuerySyntaxError
}
return false, ErrPatternCheckError
}
if !matchingOccurred {
Expand Down

0 comments on commit a21628f

Please sign in to comment.