-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix rewrite annotation parser #265
Conversation
return nil, err | ||
} | ||
|
||
rt, _ := parser.GetStringAnnotation(rewriteTo, ing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we eating this error instead of logging it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bprashanth after this PR I will refactor the parser to not consider error when the annotation is missing (that is why I'm eating the error)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah recommend returning errAnnotationNotFound or something and ignoring the error just based on the type, eg:
type errAnnotationMissing struct {
errMsg string
}
func (e *errAnnotationMissing) Error() string { return e.errMsg}
rt, err := parser.GetStringAnnotation(rewriteTo, ing)
switch t := err.(type) {
case *errAnnotationMissing:
break
default:
glog.Errorf("Failed to parse annotation, %v", err)
}
LGTM |
We need to return a Redirect type and not an error in order to get information about the SSL redirect defined in the backend
fixes #264
fixes #160