In addition to the changes provided by Mohamed, I also needed to change my request matcher.
@Bean
public RequestMatcher requestMatcher() {
// if (!swagger && !error) then apply CustomAuthenticationFilter
return new NegatedRequestMatcher(new OrRequestMatcher(Arrays.asList(
new AntPathRequestMatcher("/api-docs/**"),
new AntPathRequestMatcher("/error")
)));
}