refactor: Include function info in runtime errors #34398

pull Chand-ra wants to merge 1 commits into bitcoin:master from Chand-ra:runtime_error changing 1 files +2 −2
  1. Chand-ra commented at 5:15 am on January 24, 2026: none
    Some runtime errors in wallet/scriptpubkeyman.cpp include function information while others do not. Refactor the code to consistently include function info throughout the file.
  2. refactor: Include function info in runtime errors
    Some runtime errors in `wallet/scriptpubkeyman.cpp` include function
    information while others do not. Refactor the code to consistently
    include function info throughout the file.
    1769114751
  3. DrahtBot added the label Refactoring on Jan 24, 2026
  4. DrahtBot commented at 5:15 am on January 24, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34398.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  5. in src/wallet/scriptpubkeyman.cpp:1438 in 1769114751
    1434@@ -1435,7 +1435,7 @@ void DescriptorScriptPubKeyMan::SetCache(const DescriptorCache& cache)
    1435         FlatSigningProvider out_keys;
    1436         std::vector<CScript> scripts_temp;
    1437         if (!m_wallet_descriptor.descriptor->ExpandFromCache(i, m_wallet_descriptor.cache, scripts_temp, out_keys)) {
    1438-            throw std::runtime_error("Error: Unable to expand wallet descriptor from cache");
    1439+            throw std::runtime_error(std::string(__func__) + ": Unable to expand wallet descriptor from cache");
    


    maflcko commented at 9:35 am on January 26, 2026:

    Not sure what the goal or benefit here is.

    I don’t think there is any rule to mention the function name. And you are not even making it more consistent, because just 5 lines below, it is “missing” as well.

    Also, there is not test coverage or steps to test this.

  6. maflcko commented at 9:36 am on January 26, 2026: member
    Not sure about this. I think for internal checks, util/check should be used and for external checks, a unique error message should be use. Neither should manually include a function name.
  7. maflcko commented at 9:51 am on January 26, 2026: member

    Also, the two are already unique:

    0sh-5.2$ git grep -W '"Unable to expand descriptor"' | grep --perl-regexp '^\S+='
    1src/wallet/scriptpubkeyman.cpp=void DescriptorScriptPubKeyMan::UpgradeDescriptorCache()
    2
    3sh-5.2$ git grep -W '"Error: Unable to expand wallet descriptor from cache"' | grep --perl-regexp '^\S+='
    4src/wallet/scriptpubkeyman.cpp=void DescriptorScriptPubKeyMan::SetCache(const DescriptorCache& cache)
    

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-27 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me