Return the type when it's unknown instead of throwing an exception #9113

pull rebroad wants to merge 1 commits into bitcoin:master from rebroad:ReturnNotThrow changing 1 files +1 −1
  1. rebroad commented at 10:25 AM on November 9, 2016: contributor

    Alternative to #9112 ?

  2. Return the type when it's unknown instead of throwing an exception f962a840be
  3. in src/protocol.cpp:None in f962a840be
     174 | @@ -175,7 +175,7 @@ std::string CInv::GetCommand() const
     175 |      case MSG_FILTERED_BLOCK: return cmd.append(NetMsgType::MERKLEBLOCK);
     176 |      case MSG_CMPCT_BLOCK:    return cmd.append(NetMsgType::CMPCTBLOCK);
     177 |      default:
     178 | -        throw std::out_of_range(strprintf("CInv::GetCommand(): type=%d unknown type", type));
     179 | +        return strprintf("0x%08x", type);
    


    paveljanik commented at 10:26 AM on November 9, 2016:

    Or even unknown(0x%08x)?

  4. paveljanik commented at 10:28 AM on November 9, 2016: contributor

    I prefer this solution because it fixes the cause - throwing the exception.

  5. fanquake added the label Docs and Output on Nov 9, 2016
  6. laanwj commented at 9:59 AM on November 11, 2016: member

    Closing in favor of #9112

  7. laanwj closed this on Nov 11, 2016

  8. MarcoFalke locked this on Sep 8, 2021

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-04-13 18:15 UTC

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