[bisq-network/bisq] Improve takeoffer error handing (#5294)
Stan
notifications at github.com
Wed Mar 10 18:37:04 CET 2021
UI specific task runner validation errors cannot be passed to the client via a typical `ErrorMessageHandler`. This change uses a new `GrpcErrorMessageHandler` implementation that places an optional `AvailabilityResult` in the `takeoffer` response if an offer is not available. The client can derive a better failure reason message from the reply's AvailabilityResult.
- `GrpcErrorMessageHandler` Add new `ErrorMessageHandler` 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 the `ErrorMessageHandler` interface.
- `GrpcTradesService, CoreApi, CoreTradesService`: Adjust the `takeoffer` error handling to give a failure reason provided by the new `GrpcErrorMessageHandler`.
- `pb.proto` Add `PRICE_CHECK_FAILED` to enum `AvailabilityResult`.
- `grpc.proto` Add enum `AvailabilityResult` to `TakeOfferReply` message. This field is populated by the `GrpcErrorMessageHandler` when `takeoffer` fails, making it easier to give CLI users a stylistically consistent failure reason.
- `OpenOfferManager` Inject `CoreContex` to know isApiUser. Set AvailabilityResult = `PRICE_CHECK_FAILED` if isApiUser=true, leaving it as `UNKNOWN_FAILURE` for isApiUser=false.
- OpenOfferManagerTest Adjusted to new `CoreContext` constructor arg.
- `GrpcClient` Adjusted `takeOffer` to convert `AvailabilityResult` 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`.
You can view, comment on, or merge this pull request online at:
https://github.com/bisq-network/bisq/pull/5294
-- Commit Summary --
* Fix singleton CoreContext usage
* Adjust protos for takeoffer error handing
* Inject CoreContext into OpenOfferManager, adjust test
* Adjust grpc & core services to new takeoffer error handling
* Convert AvailabilityResult to error msg when takeoffer fails
* Add missing grpc exception catch blocks
-- File Changes --
M apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java (62)
M apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java (72)
M cli/src/main/java/bisq/cli/GrpcClient.java (72)
M core/src/main/java/bisq/core/api/CoreApi.java (7)
M core/src/main/java/bisq/core/api/CoreOffersService.java (8)
M core/src/main/java/bisq/core/api/CoreTradesService.java (17)
M core/src/main/java/bisq/core/offer/AvailabilityResult.java (9)
M core/src/main/java/bisq/core/offer/OpenOfferManager.java (12)
M core/src/test/java/bisq/core/offer/OpenOfferManagerTest.java (72)
A daemon/src/main/java/bisq/daemon/grpc/GrpcErrorMessageHandler.java (104)
M daemon/src/main/java/bisq/daemon/grpc/GrpcExceptionHandler.java (19)
M daemon/src/main/java/bisq/daemon/grpc/GrpcTradesService.java (35)
M proto/src/main/proto/grpc.proto (1)
M proto/src/main/proto/pb.proto (1)
-- Patch Links --
https://github.com/bisq-network/bisq/pull/5294.patch
https://github.com/bisq-network/bisq/pull/5294.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5294
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210310/ac3d795f/attachment-0001.htm>
More information about the bisq-github
mailing list