To fail with ISE a REST endpoint can either throw an exception or return
Response.InternalServerError (since change Ie58b4ace6). If
Response.InternalServerError is returned as response and the client
tries to read its value this fails with an UnsupportedOperationException
and the original cause for the ISE is lost. Fix this by throwing the
original cause from Response.InternalServerError#value(). Doing this
requires to handle exceptions when the Response#value() method is
called, but this seems to be manageable. The alternative would be to
revert change Ie58b4ace6.
The current situation is especially bad for analysing test failures that
are caused by ISEs because in this case the test fails with the
UnsupportedOperationException that is thrown by
Response.InternalServerError#value(), but we need to know the original
cause.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I89c0c68bf25a550b9b9be577f42f73c7752f3036