Output a better error message when running rbt patch --print
Review Request #9490 — Created Jan. 16, 2018 and discarded
When running
rbt patch --print
outside of a repository directory and
without providing the--server
parameter or having a~/.reviewboardrc
file containingREVIEWBOARD_URL
, the command would output that the
current directory does not contain a supported repository.The command is expected to work outside these repository directories. By
improving the error handling inrbtools/clients/__init__.py
and in
rbtools/commands/patch.py
we can output a more precise error message.
Tested
rbt patch --print
both inside and outside of directories with
.reviewboardrc
files, as well as using--server
. Manually verified
other functions callinginitialize_scm_tool
will continue to function
as is and bubble up the new exceptions being raised.
Description | From | Last Updated |
---|---|---|
The description will be a bit easier to read with backticks around things like rbt patch --show, .reviewboardrc, REVIEWBOARD_URL, etc. … |
chipx86 | |
The testing information should wrap at around the same length as the description. |
chipx86 | |
Nit: in general, we like to put lists of things like this, imports, etc, in alphabetical order. So this should … |
mike_conley | |
Can you move the string to the next line? That will be a little nicer, since it can be self-contained. … |
chipx86 | |
Mind changing "url" to "URL" while here? |
chipx86 | |
The newline should be removed. Can you also say "for this type of repository" instead of "current SCM client."? I … |
chipx86 | |
And here. |
chipx86 | |
And here. |
chipx86 | |
Since the semantics of these errors have changed (they're not raised instead of a clean log + exit), all callers … |
chipx86 | |
This is discarding the potentially very helpful information in the original exception. |
chipx86 |
- Change Summary:
-
Fix ordering of imports
- Commit:
-
0059a42b1e41dbed1328de807c0bc9845c09b3a9ee6b86b18ba2187d9e7217dcab2a000143e1a869
Checks run (2 succeeded)
-
-
The description will be a bit easier to read with backticks around things like
rbt patch --show
,.reviewboardrc
,REVIEWBOARD_URL
, etc. as that will help visually distinguish those as self-contained literals/files/etc. -
-
Can you move the string to the next line? That will be a little nicer, since it can be self-contained. The
% client_name
would then move to the following, like:raise OptionsCheckError( '...' % client_name)
-
-
The newline should be removed.
Can you also say "for this type of repository" instead of "current SCM client."? I know it's not your text originally, but while here, we might as well remove the confusing internal-ish text.
-
-
-
Since the semantics of these errors have changed (they're not raised instead of a clean log + exit), all callers of
initialize_scm_tool
will need to also catch/re-raise the exception. -
- Description:
-
~ When running rbt patch --show outside of a repository directory and
~ without providing the --server parameter or having a ~/.reviewboardrc ~ file containing REVIEWBOARD_URL, the command would output that the ~ When running
rbt patch --show
outside of a repository directory and~ without providing the --server
parameter or having a~/.reviewboardrc
~ file containing REVIEWBOARD_URL
, the command would output that thecurrent directory does not contain a supported repository. The command is expected to work outside these repository directories. By
~ improving the error handling in rbtools/clients/init.py and in ~ rbtools/commands/patch.py we can output a more precise error message. ~ improving the error handling in rbtools/clients/__init__.py
and in~ rbtools/commands/patch.py
we can output a more precise error message. - Testing Done:
-
~ Tested
rbt patch --show
both inside and outside of directories with .reviewboardrc files, as well as using--server
. Manually verified other functions callinginitialize_scm_tool
will continue to function as is and bubble up the new exceptions being raised.~ Tested
rbt patch --show
both inside and outside of directories with+ .reviewboardrc
files, as well as using--server
. Manually verified+ other functions calling initialize_scm_tool
will continue to function+ as is and bubble up the new exceptions being raised.
- Change Summary:
-
Adjusted the exception messages as per Christian's review.
- Summary:
-
Output a better error message when running rbt patch --showOutput a better error message when running rbt patch --print
- Description:
-
~ When running
rbt patch --show
outside of a repository directory and~ When running
rbt patch --print
outside of a repository directory andwithout providing the --server
parameter or having a~/.reviewboardrc
file containing REVIEWBOARD_URL
, the command would output that thecurrent directory does not contain a supported repository. The command is expected to work outside these repository directories. By
improving the error handling in rbtools/clients/__init__.py
and inrbtools/commands/patch.py
we can output a more precise error message. - Testing Done:
-
~ Tested
rbt patch --show
both inside and outside of directories with~ Tested
rbt patch --print
both inside and outside of directories with.reviewboardrc
files, as well as using--server
. Manually verifiedother functions calling initialize_scm_tool
will continue to functionas is and bubble up the new exceptions being raised. - Commit:
-
ee6b86b18ba2187d9e7217dcab2a000143e1a869a38267bd20014927470302c3cafa92cd373b6139