-
Notifications
You must be signed in to change notification settings - Fork 38.7k
refactor: Error message bilingual_str consistency #19176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Concept ACK |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
Concept ACK. |
jonatack
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK f40dddfde231550e76043011d4211ca2fb17143d
hebasto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK f40dddfde231550e76043011d4211ca2fb17143d, tested on Linux Mint 19.3 (x86_64).
src/net_permissions.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It seems using an unnamed namespace is preferable:
- https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines.html#Rs-unnamed2
- https://stackoverflow.com/questions/154469/unnamed-anonymous-namespaces-vs-static-functions
- https://stackoverflow.com/questions/4422507/superiority-of-unnamed-namespace-over-static
- https://stackoverflow.com/questions/4977252/why-an-unnamed-namespace-is-a-superior-alternative-to-static
maflcko
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. This should also fix the failing tests when running the net permission tests in the gui
|
Probably unrelated or a bad build, but with two different debug builds on this branch and not on master, I'm seeing seeing this shortly after launching the GUI. Testing further with rebase on master. debug log
|
|
@jonatack This issue has been fixed on master |
|
Thanks, suspected as much. I just verified with a build of this branch rebased on master that the issue is gone. |
- Move the decision whether to translate an error message to where it is defined. This simplifies call sites: no more `InitError(Untranslated(...))`. - Make all functions in `util/error.h` consistently return a `bilingual_str`. We've decided to use this as error message type so let's roll with it. This has no functional changes: no messages are changed, no new translation messages are defined.
It's only used inside `net_permissions.cpp`.
Make it consistent with `Chain::initError`.
f40dddf to
6fe9890
Compare
|
|
Tested before: Tested after: ACK 6fe9890 🔣 Show signature and timestampSignature: Timestamp of file with hash |
Trying to reproduce your tests, and got: What am I doing wrong? |
hebasto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 6fe9890, tested on Linux Mint 19.3 (x86_64).
Also verified that it compiles successfully with the --enable-fuzz option.
You'll need to manually close the GUI dialogs. The python test framework can't do that for you (yet). |
After bitcoin#19176, building the gui on Bionic is failing with: ```bash CXX qt/qt_libbitcoinqt_a-guiutil.o qt/bitcoin.cpp: In function 'int GuiMain(int, char**)': qt/bitcoin.cpp:460:35: error: 'Untranslated' was not declared in this scope node->initError(strprintf(Untranslated("Error parsing command line arguments: %s\n"), error)); ``` The merge commit also failed to compile with the same error: https://travis-ci.org/github/bitcoin/bitcoin/jobs/696627543
6fe9890 refactor: Change Node::initError to take bilingual_str (Wladimir J. van der Laan) 425e7cb refactor: Put`TryParsePermissionFlags` in anonymous namespace (Wladimir J. van der Laan) 77b79fa refactor: Error message bilingual_str consistency (Wladimir J. van der Laan) Pull request description: A straightforward and hopefully uncontroversial refactor to improve consistency. - Move the decision whether to translate an individual error message to where it is defined. This simplifies call sites: no more `InitError(Untranslated(SomeFunction(...)))`. - Make all functions in `util/error.h` consistently return a `bilingual_str`. We've decided to use this as error message type so let's roll with it. This has no functional changes: no messages are changed, no new translation messages are defined. Also make a function static that can be static. ACKs for top commit: MarcoFalke: ACK 6fe9890 🔣 hebasto: ACK 6fe9890, tested on Linux Mint 19.3 (x86_64). Tree-SHA512: 1dd123ef285c4b50bbc429b2f11c9a63aaa669a84955a0a9b8134e9dc141bc38f863f798e8982ac68bbe83170e1067a87d1a87fe7f791928b7914e10bbc2ef8d
…nsistency" This reverts commit d154202.
948f113 gui: add missing translation.h include to fix build (fanquake) Pull request description: After #19176, building the gui on Bionic is failing with: ```bash CXX qt/qt_libbitcoinqt_a-guiutil.o qt/bitcoin.cpp: In function 'int GuiMain(int, char**)': qt/bitcoin.cpp:460:35: error: 'Untranslated' was not declared in this scope node->initError(strprintf(Untranslated("Error parsing command line arguments: %s\n"), error)); ``` The merge commit also failed to compile with the same error: https://travis-ci.org/github/bitcoin/bitcoin/jobs/696627543 ACKs for top commit: hebasto: ACK 948f113, tested on Linux Mint 19.3 (x86_64): it fixes compiling error with the `--disable-wallet` configure option. Tree-SHA512: db0197b110b3a7d05af2ceb29fbe9eeb6521d28f53b6267aa6d07a975886adb5c6485af79506ab6c66ed101e32292feeaff3707cdbc11432e5b97400953d5631
After bitcoin#19176, building the gui on Bionic is failing with: ```bash CXX qt/qt_libbitcoinqt_a-guiutil.o qt/bitcoin.cpp: In function 'int GuiMain(int, char**)': qt/bitcoin.cpp:460:35: error: 'Untranslated' was not declared in this scope node->initError(strprintf(Untranslated("Error parsing command line arguments: %s\n"), error)); ``` The merge commit also failed to compile with the same error: https://travis-ci.org/github/bitcoin/bitcoin/jobs/696627543
After bitcoin#19176, building the gui on Bionic is failing with: ```bash CXX qt/qt_libbitcoinqt_a-guiutil.o qt/bitcoin.cpp: In function 'int GuiMain(int, char**)': qt/bitcoin.cpp:460:35: error: 'Untranslated' was not declared in this scope node->initError(strprintf(Untranslated("Error parsing command line arguments: %s\n"), error)); ``` The merge commit also failed to compile with the same error: https://travis-ci.org/github/bitcoin/bitcoin/jobs/696627543
Summary:
```
A straightforward and hopefully uncontroversial refactor to improve
consistency.
Move the decision whether to translate an individual error message
to where it is defined. This simplifies call sites: no more
InitError(Untranslated(SomeFunction(...))).
Make all functions in util/error.h consistently return a
bilingual_str. We've decided to use this as error message type so let's
roll with it.
This has no functional changes: no messages are changed, no new
translation messages are defined.
Also make a function static that can be static.
```
Backport of core [[bitcoin/bitcoin#19176 | PR19176]].
The change to `kitchen_sink.cpp` is not ported since this file hasn't
been ported yet, but the compiler will make the change obvious when
needed.
Depends on D8650.
Test Plan:
ninja all check-all
ninja bitcoin-fuzzers
Reviewers: #bitcoin_abc, PiRK
Reviewed By: #bitcoin_abc, PiRK
Differential Revision: https://reviews.bitcoinabc.org/D8651
A straightforward and hopefully uncontroversial refactor to improve consistency.
Move the decision whether to translate an individual error message to where it is defined. This simplifies call sites: no more
InitError(Untranslated(SomeFunction(...))).Make all functions in
util/error.hconsistently return abilingual_str. We've decided to use this as error message type so let's roll with it.This has no functional changes: no messages are changed, no new translation messages are defined.
Also make a function static that can be static.