Files REST endpoint: Fail with ISE on PatchListNotAvailableException
At the moment PatchListNotAvailableException results in 404 Not Found, however this response code is only appropriate if a resource that was specified in the URL is not found. PatchListCacheImpl throws PatchListNotAvailableException if data is inconsistent (patch set has no revision, computing patch list failed) or if the patch set was not set or failed to load. These are all cases which should rather result in a 500 Internal Server Error. Any missing revision is already handled by the Revisions REST collection which correctly fails with 404 Not Found in this case. The Revisions collection parses the revision before the Files REST endpoint is invoked, hence it is safe for the Files REST endpoint to assume that the revision exists. Handling PatchListNotAvailableException as 404 Not Found is bad because it leaks internal information to the user, e.g. the response may contain the following message: "com.google.common.util.concurrent.UncheckedExecutionException: org.eclipse.jgit.errors.LargeObjectException: unknown object exceeds size limit" Also showing an error dialog instead of the Not Found page gives better feedback to the user about what has really happened. Change-Id: I2ad01ece93561788120292affa03ed09d184eaa1 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -21,6 +21,10 @@ public class PatchListNotAvailableException extends Exception {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public PatchListNotAvailableException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public PatchListNotAvailableException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
Reference in New Issue
Block a user