<p>UI specific task runner validation errors cannot be passed to the client via a typical <code>ErrorMessageHandler</code>.  This change uses a new <code>GrpcErrorMessageHandler</code> implementation that places an optional <code>AvailabilityResult</code> in the <code>takeoffer</code> response if an offer is not available.  The client can derive a better failure reason message from the reply's AvailabilityResult.</p>
<ul>
<li>
<p><code>GrpcErrorMessageHandler</code>  Add new <code>ErrorMessageHandler</code> 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.</p>
</li>
<li>
<p><code>GrpcExceptionHandler</code>  Add a method for working with the  <code>ErrorMessageHandler</code> interface.</p>
</li>
<li>
<p><code>GrpcTradesService, CoreApi, CoreTradesService</code>:  Adjust the <code>takeoffer</code> error handling to give a failure reason provided by the new <code>GrpcErrorMessageHandler</code>.</p>
</li>
<li>
<p><code>pb.proto</code>  Add <code>PRICE_CHECK_FAILED</code> to enum <code>AvailabilityResult</code>.</p>
</li>
<li>
<p><code>grpc.proto</code>  Add enum <code>AvailabilityResult</code> to <code>TakeOfferReply</code> message.  This field is populated by the <code>GrpcErrorMessageHandler</code> when <code>takeoffer</code> fails, making it easier to give CLI users a stylistically consistent failure reason.</p>
</li>
<li>
<p><code>OpenOfferManager</code>  Inject <code>CoreContex</code> to know isApiUser.  Set AvailabilityResult = <code>PRICE_CHECK_FAILED</code> if isApiUser=true, leaving it as <code>UNKNOWN_FAILURE</code> for isApiUser=false.</p>
</li>
<li>
<p>OpenOfferManagerTest  Adjusted to new <code>CoreContext</code> constructor arg.</p>
</li>
<li>
<p><code>GrpcClient</code>  Adjusted <code>takeOffer</code> to convert <code>AvailabilityResult</code> to user error message if the call fails -- does not return a trade.</p>
</li>
<li>
<p>Added grpc exception catch blocks missing from some api test cases in <code>apitest/src/test/java/bisq/apitest/method/trade</code>.</p>
</li>
</ul>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq/pull/5294'>https://github.com/bisq-network/bisq/pull/5294</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Fix singleton CoreContext usage</li>
  <li>Adjust protos for takeoffer error handing</li>
  <li>Inject CoreContext into OpenOfferManager, adjust test</li>
  <li>Adjust grpc & core services to new takeoffer error handling</li>
  <li>Convert AvailabilityResult to error msg when takeoffer fails</li>
  <li>Add missing grpc exception catch blocks</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-80fde285109a91d7581e771828393b6c87ac3b2a7e7de6ee750e7d41e594650a">apitest/src/test/java/bisq/apitest/method/trade/TakeBuyBTCOfferTest.java</a>
    (62)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-0a94ee487ea9d0b7b440b8688f6e9df897fd089fc84ead5f6cc9ca9453ad3b21">apitest/src/test/java/bisq/apitest/method/trade/TakeSellBTCOfferTest.java</a>
    (72)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-ae5b5d0bb9a18998e885050698a2ce8dde809059fffc344f1d24a937e6ecbae3">cli/src/main/java/bisq/cli/GrpcClient.java</a>
    (72)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-fb5876d3b212d239a14d78529ac498b30a2dbb8e3f184ba9bd711a5d4901fb62">core/src/main/java/bisq/core/api/CoreApi.java</a>
    (7)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-e66126b732dbd45cde04307641186caa214407bc74403812b10d3ebf18d2aecc">core/src/main/java/bisq/core/api/CoreOffersService.java</a>
    (8)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-7ab5c96db69bcc7ca05627ada97fd93b423f7df355641a7cd371d31f2039baf9">core/src/main/java/bisq/core/api/CoreTradesService.java</a>
    (17)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-cf44b8d653d0b462ac0e0ea6a90b57880ed55375f4c01580ace3d39cdcb4864f">core/src/main/java/bisq/core/offer/AvailabilityResult.java</a>
    (9)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-5e151a76cef2e8ffea07c4d456f312d5eb446f0fa1b813c467b677a9323164c6">core/src/main/java/bisq/core/offer/OpenOfferManager.java</a>
    (12)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-a3776f22849f450a0bbfd449e5d2d82039c89d061f20636bc4015c5879756a4f">core/src/test/java/bisq/core/offer/OpenOfferManagerTest.java</a>
    (72)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-0928829acf10968e32b779e63a3ef3e6f9d807e10361a604b3785110f35231af">daemon/src/main/java/bisq/daemon/grpc/GrpcErrorMessageHandler.java</a>
    (104)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-bc6b772b057c68f8b6f8ffc31f14525ad90a2b3d407835d9e55ce9e5f70002e3">daemon/src/main/java/bisq/daemon/grpc/GrpcExceptionHandler.java</a>
    (19)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-0999abe6a76f18c5be810b6c5436cea6d708c11d99ed316d0397c3ebbc6aa777">daemon/src/main/java/bisq/daemon/grpc/GrpcTradesService.java</a>
    (35)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-dcb44a0045a5b02cde5bd2f45051b7d9293f87180111c7ea57f0d0eb85d0f393">proto/src/main/proto/grpc.proto</a>
    (1)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/5294/files#diff-51dcd1d852312df65738ff2bd493fdb0f187f50fb7d7324158c8b57fc1de7da7">proto/src/main/proto/pb.proto</a>
    (1)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/5294.patch'>https://github.com/bisq-network/bisq/pull/5294.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/5294.diff'>https://github.com/bisq-network/bisq/pull/5294.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/5294">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNWDHH4R63JBGZWIGOTTC6U4BANCNFSM4Y6QQ5SA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNUAAKINLWKY4GMXKHTTC6U4BA5CNFSM4Y6QQ5SKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4MK3XUNA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/5294",
"url": "https://github.com/bisq-network/bisq/pull/5294",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>