mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Throw exception when server returns error in ListObjectsCommand
ListObjectsCommand is a base class for a number of List commands that query the tools server with the command input, and then show the user the server's reply. For example, ListDomainsCommand queries ListDomainsAction with the input TLDs from the user, and then prints the resulting domains for the user. Currently, when the server query returns an error (because, e.g., the user of ListDomainsCommand gave a non-existing TLD) - ListObjectsCommand just prints the error message to stdout, and returns successfully. That means that any automatic tool would think the command succeeded. This CL changes the behavior of ListObjectsCommand to throw an exception with the error message if the server returned an error. This results in the nomulus command failing if the server encountered an error. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=194393053
This commit is contained in:
parent
82ded21b9e
commit
d618ae758b
1 changed files with 2 additions and 2 deletions
|
@ -114,9 +114,9 @@ abstract class ListObjectsCommand implements RemoteApiCommand, ServerSideCommand
|
|||
if (status.equals("error")) {
|
||||
obj = responseMap.get("error");
|
||||
if (obj == null) {
|
||||
throw new VerifyException("Server returned no error message");
|
||||
throw new VerifyException("Server returned an error with no error message");
|
||||
}
|
||||
System.out.println(obj);
|
||||
throw new VerifyException(String.format("Server returned an error with message '%s'", obj));
|
||||
// Handle success.
|
||||
} else if (status.equals("success")) {
|
||||
obj = responseMap.get("lines");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue