Repository navigation
HBASE-22316 Record the stack trace for current thread in FutureUtils.get - #264
Conversation
|
The stack trace in the newly introduced UT is org.apache.hadoop.hbase.HBaseIOException: Inject error! |
| } else if (cause instanceof Error) { | ||
| setStackTrace(cause); | ||
| throw (Error) cause; | ||
| } else { |
There was a problem hiding this comment.
Why don't setStackTrace here?
There was a problem hiding this comment.
We just create a new IOException, it will record the stack trace when creating the new IOException. When you call printStackTrace, you will see a 'Caused by:'
| error.setStackTrace(newStackTrace); | ||
| } | ||
|
|
||
| private static IOException rethrow(ExecutionException error) throws IOException { |
There was a problem hiding this comment.
The return parameter can be void?
There was a problem hiding this comment.
This is for the caller, we can just use throw rethrow(e), otherwise you need to manually write an unused throw new IOException() at the end.
| Throwable cause = e.getCause(); | ||
| Throwables.propagateIfPossible(cause, IOException.class); | ||
| throw new IOException(cause); | ||
| throw rethrow(e); |
There was a problem hiding this comment.
There will be a compile error if you do not have a return or throw statement in this block...
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
No description provided.