You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
They can fail for many reasons, but a few stand out:
DeregisterInstance fails if the instance does not exist (HTTP status code 404).
DeregisterInstance fails if the instance did exist (HTTP status code 200).
This is due to expecting status code 204, even though the Eureka documentation promises status code 200 for a successful deletion. This mismatch makes me wonder if anyone else is using this method.
To work around these problems, I had to write the following function to filter errors that arise when calling DeregisterInstance:
Both ReregisterInstance and RegisterInstance can fail with status code 400 if Eureka deems the instance payload invalid. Note that it's not possible for registration to fail due to a collision with an existing instance with the same ID; Eureka replaces the existing registration.
It would be helpful for callers to be able to discern why these operations failed. Rather than introducing sentinel error values or types, I propose that we introduce a few exported functions:
InstanceWasMissing(error) bool
True for failures in DeregisterInstance due to receiving status code 404
InstanceWasInvalid(error) bool
True for failures in RegisterInstance and DeregisterInstance due to receiving status code 400
Do you have counter-proposals for these names? Are there other functions you can think of that would clarify what went wrong?
The text was updated successfully, but these errors were encountered:
See this gist (errors.go) for an adaptation of the interpretive predicate functions I had proposed in #47. You can see that the caller still has consider which operation he had attempted in order to know which function to call, due to Eureka's irregular treatment of metadata updates, but it beats parsing the error messages.
If you change your mind about whether fargo should include these or similar predicates, we can open another issue.
At present, the following functions return type
error
:EurekaConnection.RegisterInstance
EurekaConnection.ReregisterInstance
EurekaConnection.DeregisterInstance
They can fail for many reasons, but a few stand out:
DeregisterInstance
fails if the instance does not exist (HTTP status code 404).DeregisterInstance
fails if the instance did exist (HTTP status code 200).This is due to expecting status code 204, even though the Eureka documentation promises status code 200 for a successful deletion. This mismatch makes me wonder if anyone else is using this method.
To work around these problems, I had to write the following function to filter errors that arise when calling
DeregisterInstance
:That is clear evidence of a gap in the interface.
Both
ReregisterInstance
andRegisterInstance
can fail with status code 400 if Eureka deems the instance payload invalid. Note that it's not possible for registration to fail due to a collision with an existing instance with the same ID; Eureka replaces the existing registration.It would be helpful for callers to be able to discern why these operations failed. Rather than introducing sentinel error values or types, I propose that we introduce a few exported functions:
InstanceWasMissing(error) bool
True for failures in
DeregisterInstance
due to receiving status code 404InstanceWasInvalid(error) bool
True for failures in
RegisterInstance
andDeregisterInstance
due to receiving status code 400Do you have counter-proposals for these names? Are there other functions you can think of that would clarify what went wrong?
The text was updated successfully, but these errors were encountered: