[bisq-network/bisq] Send meaningful io.grpc.Status.Code to gRPC clients [No. 2] (PR #6088)

Stan notifications at github.com
Sun Mar 6 00:40:14 CET 2022


Exceptions thrown by the Core API services up to the daemon's Grpc*Services have to be converted into gRPC `StatusRuntimeException`s before being sent to  gRPC clients.  Most of these gRPC `StatusRuntimeException`s had a gRPC `Status.Code.UNKNOWN`, which not helpful to client error handlers.

This change partially resolves the issue by sending more meaningful gRPC response status codes to clients, where possible.  But it is not as comprehensive as it can be for a webapp because HTTP has so many more possible response status codes than the gRPC library (sixteen).   See:  https://github.com/grpc/grpc-java/blob/master/api/src/main/java/io/grpc/Status.java

There are three types of changes:

- Create custom exceptions in `bisq.core.api.exception`.

- Map any custom `bisq.core.api.exception` to a meaningful `io.grpc.Status.Code `within daemon Grpc*Service classes.

- Adjust apitest cases to new grpc status codes.  

Based on branch `move-cli-crypto-offer-filter-to-server`, PR https://github.com/bisq-network/bisq/pull/6086
You can view, comment on, or merge this pull request online at:

  https://github.com/bisq-network/bisq/pull/6088

-- Commit Summary --

  * Move get (cryptocurrency) offer filter to daemon
  * Force rebuild after github action ECONNRESET
  * Send meaningful io.grpc.Status.Code to gRPC clients

-- File Changes --

    M apitest/src/test/java/bisq/apitest/method/MethodTest.java (12)
    M apitest/src/test/java/bisq/apitest/method/RegisterDisputeAgentsTest.java (2)
    M apitest/src/test/java/bisq/apitest/method/offer/BsqSwapOfferTest.java (5)
    M apitest/src/test/java/bisq/apitest/method/offer/CreateBSQOffersTest.java (4)
    M apitest/src/test/java/bisq/apitest/method/offer/CreateXMROffersTest.java (4)
    M apitest/src/test/java/bisq/apitest/method/offer/EditOfferTest.java (10)
    M apitest/src/test/java/bisq/apitest/method/trade/AbstractTradeTest.java (10)
    M apitest/src/test/java/bisq/apitest/method/trade/BsqSwapBuyBtcTradeTest.java (4)
    M apitest/src/test/java/bisq/apitest/method/trade/BsqSwapSellBtcTradeTest.java (4)
    M apitest/src/test/java/bisq/apitest/method/trade/FailUnfailTradeTest.java (20)
    M apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBSQOfferTest.java (4)
    M apitest/src/test/java/bisq/apitest/method/trade/TakeBuyXMROfferTest.java (4)
    M apitest/src/test/java/bisq/apitest/method/trade/TakeSellBSQOfferTest.java (4)
    M apitest/src/test/java/bisq/apitest/method/trade/TakeSellXMROfferTest.java (4)
    M apitest/src/test/java/bisq/apitest/method/wallet/BtcTxFeeRateTest.java (2)
    M apitest/src/test/java/bisq/apitest/method/wallet/WalletProtectionTest.java (12)
    M cli/src/main/java/bisq/cli/CliMain.java (3)
    M cli/src/main/java/bisq/cli/GrpcClient.java (45)
    M cli/src/main/java/bisq/cli/request/OffersServiceRequest.java (72)
    M cli/src/test/java/bisq/cli/AbstractCliTest.java (2)
    M core/src/main/java/bisq/core/api/CoreDisputeAgentsService.java (9)
    M core/src/main/java/bisq/core/api/CoreHelpService.java (4)
    M core/src/main/java/bisq/core/api/CoreOffersService.java (74)
    M core/src/main/java/bisq/core/api/CorePaymentAccountsService.java (7)
    M core/src/main/java/bisq/core/api/CoreTradesService.java (11)
    M core/src/main/java/bisq/core/api/CoreWalletsService.java (68)
    M core/src/main/java/bisq/core/api/EditOfferValidator.java (9)
    A core/src/main/java/bisq/core/api/exception/AlreadyExistsException.java (31)
    A core/src/main/java/bisq/core/api/exception/FailedPreconditionException.java (32)
    A core/src/main/java/bisq/core/api/exception/NotAvailableException.java (31)
    A core/src/main/java/bisq/core/api/exception/NotFoundException.java (33)
    A core/src/main/java/bisq/core/api/exception/package-info.java (29)
    M core/src/main/java/bisq/core/locale/CurrencyUtil.java (13)
    M daemon/src/main/java/bisq/daemon/grpc/GrpcExceptionHandler.java (59)
    M daemon/src/main/java/bisq/daemon/grpc/interceptor/GrpcServiceRateMeteringConfig.java (6)

-- Patch Links --

https://github.com/bisq-network/bisq/pull/6088.patch
https://github.com/bisq-network/bisq/pull/6088.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/6088
You are receiving this because you are subscribed to this thread.

Message ID: <bisq-network/bisq/pull/6088 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20220305/a0f10a8d/attachment.htm>


More information about the bisq-github mailing list