-
Notifications
You must be signed in to change notification settings - Fork 1.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
Improve takeoffer error handing #5294
Improve takeoffer error handing #5294
Conversation
- Add PRICE_CHECK_FAILED to enum AvailabilityResult. - Add enum AvailabilityResult to TakeOfferReply message.
- GrpcErrorMessageHandler A new ErrorMessageHandler implementation to get around the api specific problem of having to use Task ErrorMessageHandlers that build task error messages for the UI. - GrpcExceptionHandler A new method for working with the ErrorMessageHandler interface. - GrpcTradesService, CoreApi, CoreTradesService: Ajdusted takeoffer error handling to give a failure reason provided by the new GrpcErrorMessageHandler.
PR #5292 should be reviewed and merged before this one. |
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.
Tests passing.
LGTM.
ACK
- Add description msg TakeOfferReply proto, and fromProto method to core.offer.enum AvailabilityResult. The description field maps a client usable error message to the enum. - Adjust GrpcErrorMessageHandler to add AvailabilityResult.description() to takeoffer reply. - Refactor (split up) GrpcClient's takeOffer. Add getTakeOfferReply() to give clients a chance to make choices based on the reply's AvailabilityResult when the takeoffer command did not result in a trade. (Some errors are fatal, some not.)
UNCONF_TX_LIMIT_HIT, | ||
MAKER_DENIED_API_USER | ||
MAKER_DENIED_API_USER, | ||
PRICE_CHECK_FAILED |
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.
Just to confirm, this would fail to parse by old clients and thus use the first element in the enum, which is UNKNOWN_FAILURE
, which makes sense.
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.
I confirmed this by sending protobuf.AvailabilityResult.PRICE_CHECK_FAILED(13)
to a client that does not have that proto enum value, and the client received UNKNOWN_ENUM_VALUE_AvailabilityResult_13
.
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.
utACK
UI specific task runner validation errors cannot be passed to the client via a typical
ErrorMessageHandler
. This change uses a newGrpcErrorMessageHandler
implementation that places an optionalAvailabilityResult
in thetakeoffer
response if an offer is not available. The client can derive a better failure reason message from the reply's AvailabilityResult.GrpcErrorMessageHandler
Add newErrorMessageHandler
implementation to get around the api specific problem of having to use an interface that is designed to build task error messages for the UI.GrpcExceptionHandler
Add a method for working with theErrorMessageHandler
interface.GrpcTradesService, CoreApi, CoreTradesService
: Adjust thetakeoffer
error handling to give a failure reason provided by the newGrpcErrorMessageHandler
.pb.proto
AddPRICE_CHECK_FAILED
to enumAvailabilityResult
.grpc.proto
Add enumAvailabilityResult
toTakeOfferReply
message. This field is populated by theGrpcErrorMessageHandler
whentakeoffer
fails, making it easier to give CLI users a stylistically consistent failure reason.OpenOfferManager
InjectCoreContex
to know isApiUser. Set AvailabilityResult =PRICE_CHECK_FAILED
if isApiUser=true, leaving it asUNKNOWN_FAILURE
for isApiUser=false.OpenOfferManagerTest Adjusted to new
CoreContext
constructor arg.GrpcClient
AdjustedtakeOffer
to convertAvailabilityResult
to user error message if the call fails -- does not return a trade.Added grpc exception catch blocks missing from some api test cases in
apitest/src/test/java/bisq/apitest/method/trade
.