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 |
-
-
rbtools/commands/patch.py (Diff revision 1) Nit: in general, we like to put lists of things like this, imports, etc, in alphabetical order. So this should probably go before line 4.
Change Summary:
Fix ordering of imports
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+30 -23) |
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. -
-
rbtools/clients/__init__.py (Diff revision 2) 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)
-
-
rbtools/clients/__init__.py (Diff revision 2) 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.
-
-
-
rbtools/commands/patch.py (Diff revision 2) 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. -
rbtools/commands/patch.py (Diff revision 2) This is discarding the potentially very helpful information in the original exception.
Description: |
|
|||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
Change Summary:
Adjusted the exception messages as per Christian's review.
Summary: |
|
|||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||
Testing Done: |
|
|||||||||||||||||||||||||||
Commit: |
|
|||||||||||||||||||||||||||
Diff: |
Revision 3 (+31 -23) |