monero icon indicating copy to clipboard operation
monero copied to clipboard

Provide last error from http client to UI

Open vtnerd opened this issue 4 years ago • 9 comments

This stores the last std::error_code while doing HTTP client I/O to make it available to UIs. With Boost 1.65+ this provides more useful messages with the CLI wallet, and hopefully GUI wallet too. The primary purpose is for an (shortly) upcoming DANE/TLSA patch that uses DNSSEC for the "autodetect" SSL mode with wallets. I broke this into its own patch because its useful even if the DANE/TLSA patch is rejected or reverted.

vtnerd avatar Dec 03 '20 00:12 vtnerd

Our release binaries use boost 1.64. Would it be useful to bump it? If yes, which version would you suggest?

selsta avatar Dec 03 '20 00:12 selsta

Our release binaries use boost 1.64. Would it be useful to bump it? If yes, which version would you suggest?

Crap. I should've checked before doing this work. Its useful to get this fixed because the official release builds will not have useful messages displayed in the UI.

It should be possible to re-write the patch around boost::system::error_code so that upgrading is unnecessary. In hindsight, it may have been a mistake to use std::error_code previously given our reliance on Boost (and ASIO in particular). And Boost 1.69+ can have constexpr error_category objects. This may incur the wraith of some reviewers because it'll result in yet another PR by me to convert things.

OTOH, Boost provides a boost::system::error_code -> std::error_code conversion (that's kind of clunky IMO) in Boost 1.65+, and Boost provides no support for older releases.

@selsta do you know how Boost 1.64 was selected previously? Just because it was the latest release?

vtnerd avatar Dec 03 '20 04:12 vtnerd

AFAIK there is no reason for Boost 1.64. We can upgrade to Boost 1.68 without any changes (#6693), if we want a even newer version some changes to the depends build system are necessary.

selsta avatar Dec 03 '20 13:12 selsta

@0xFFFC0000 @jeffro256 @j-berman This has been around for years, and will help with a potential DANE/TSLA or trust-on-first patch. It simply stores the last error_code in the http client, so that it can be displayed to the user UI.

vtnerd avatar Feb 08 '24 16:02 vtnerd

Forgot to add, I made the changes moo suggested years ago, and rebased.

vtnerd avatar Feb 08 '24 16:02 vtnerd

LGTM too.

0xFFFC0000 avatar Feb 09 '24 05:02 0xFFFC0000

Force pushed a fix to api/wallet.cpp.

vtnerd avatar Feb 10 '24 15:02 vtnerd

@selsta can this get in the merge queue?

vtnerd avatar Mar 13 '24 17:03 vtnerd

@jeffro256 @0xFFFC0000 @selsta I made a mistake in not updating all of the check_connection calls. I instead decided against inverting the call behavior, and instead added a boost::system::error_code* function parameter. Let's see if this goes green (it should).

So please look/inspect again!

vtnerd avatar Mar 14 '24 16:03 vtnerd