Fixes #25505 (comment)
Rephrase error message for invalid value of `-peertimeout` #25506
pull ghost wants to merge 1 commits into bitcoin:master from changing 1 files +1 −1-
ghost commented at 10:10 PM on June 29, 2022: none
-
in src/init.cpp:971 in 1642256d2f outdated
964 | @@ -965,8 +965,10 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb 965 | } 966 | 967 | peer_connect_timeout = args.GetIntArg("-peertimeout", DEFAULT_PEER_CONNECT_TIMEOUT); 968 | - if (peer_connect_timeout <= 0) { 969 | + if (peer_connect_timeout < 0) { 970 | return InitError(Untranslated("peertimeout cannot be configured with a negative value.")); 971 | + } else if (peer_connect_timeout == 0) { 972 | + return InitError(Untranslated("invalid value for peertimeout."));
kristapsk commented at 10:24 PM on June 29, 2022:return InitError(Untranslated("Invalid value for peertimeout."));
unknown commented at 10:40 PM on June 29, 2022:Reasons for using lowercasel
iinstead of uppercase:- Error is printed with uppercase
Ein this format:Error: <error message> - Other error starts with lowercase
pso maintain consistency
kristapsk commented at 10:49 PM on June 29, 2022:Other error messages not starting with argument name does not start with lowercase. Lowercase is used above because
peertimeoutandPeertimeoutwill be different arguments. See https://github.com/bitcoin/bitcoin/blob/1642256d2ffb69b3a7386d9f99d584bf8c2df090/src/init.cpp#L1053, for example.
unknown commented at 11:01 PM on June 29, 2022:unknown force-pushed on Jun 29, 2022kristapsk approvedkristapsk commented at 11:09 PM on June 29, 2022: contributorACK 6cd4bf35757d034556226eb9576d735c689c85ec
MarcoFalke commented at 6:12 AM on June 30, 2022: memberNot sure if we need two error messages to state a simple thing: A non-zero positive timeout is needed.
kristapsk commented at 7:35 AM on June 30, 2022: contributorNot sure if we need two error messages to state a simple thing: A non-zero positive timeout is needed.
Single message is alternative approach, would then suggest "peertimeout must be a non-zero positive integer".
ghost commented at 7:51 AM on June 30, 2022: noneNot sure if we need two error messages to state a simple thing: A non-zero positive timeout is needed.
The error is incorrect and should be based on user input. It makes no sense to print negative value error when zero or non integer was entered.
Other approach is to replace old error with a new error that prints user input and calls it invalid similar to a few other errors and https://github.com/bitcoin/bitcoin/pull/22087/. Or remove
=, just keepif (peer_connect_timeout < 0)and no error for other invalid values like-prune.rephrase error for invalid timeout 748a10e896unknown renamed this:add error msg for invalid value of `-peertimeout`
Rephrase error message for invalid value of `-peertimeout`
on Jun 30, 2022unknown force-pushed on Jun 30, 2022ghost commented at 8:48 AM on June 30, 2022: noneNot sure if we need two error messages to state a simple thing: A non-zero positive timeout is needed.
Single message is alternative approach, would then suggest "peertimeout must be a non-zero positive integer". @kristapsk @MarcoFalke Changed the error message in last commit. No new errors.
kristapsk approvedkristapsk commented at 12:07 PM on June 30, 2022: contributorre-ACK 748a10e896b84f084f573472428b76d49c3c9795
brunoerg approvedw0xlt approvedw0xlt commented at 12:55 PM on June 30, 2022: contributorMarcoFalke added the label Docs on Jun 30, 2022MarcoFalke merged this on Jun 30, 2022MarcoFalke closed this on Jun 30, 2022MarcoFalke referenced this in commit b6cf0f8848 on Jun 30, 2022sidhujag referenced this in commit 97f981e659 on Jun 30, 2022sidhujag referenced this in commit 8d61dab2e7 on Jun 30, 2022DrahtBot locked this on Jun 30, 2023 - Error is printed with uppercase
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-17 15:13 UTC
More mirrored repositories can be found on mirror.b10c.me