afex / hystrix-go

Netflix's Hystrix latency and fault tolerance library, for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Treat bad requests separately from other errors

epivovar opened this issue · comments

Feature request: Need a separate treatment of errors returned by the hystrix command due to illegal arguments or non-system failures, similar to HystrixBadRequestException in the Java version of hystrix

Workaround:

  1. Make a channel badRequests before engaging hystrix.Go
  2. Inside the user-defined hystrix command, route appropriate errors to badRequests instead of returning them
  3. After command execution, handle errors from badRequests in addition to those returned by hystrix.Go

Proposal:

  1. Create an interface badRequest in hystrix
  2. Add an exported method to be used inside hystrix commands that converts an error to a type that implements both error and badRequest interfaces so that the commands will return it instead of the original error
  3. badRequest errors neither count against the failure metrics nor trigger fallback logic
  4. After hystrix.Go execution, user's code can pull all errors from the same channel and if necessary, can treat badRequest errors separately