minio-java
minio-java copied to clipboard
Exception infomation lost when some Exception occurs
I meet an OOM Exception ,but it's hard to find out . The exception caught outside just says: java.lang.RuntimeException: null
Caused by: java.lang.RuntimeException: null
at io.minio.S3Base.throwEncapsulatedException(S3Base.java:243)
at io.minio.MinioClient.putObject(MinioClient.java:1375)
....
I personally strongly advise to fix this by changing io.minio.S3Base.java:243 with :
- throw new RuntimeException(exc.getCause());
+ throw new RuntimeException("Failed to put object:" + ext.getMessage(), exc);
The error message may be something better. https://github.com/minio/minio-java/blob/8c7a5be3a42ae0e1f4da9269e97a30729b3cbf83/api/src/main/java/io/minio/S3Base.java#L243
Feel free to send a PR
Unfortunately, only the ExecutionException
passed into throwEncapsulatedException
has the stack trace from the call site. The cause in it doesn't have a meaningful stack trace since it comes from a different thread. The only way to keep the stack trace would be to keep ExecutionException
, but doing so would make pretty much all checked exception annotations on API functions invalid and make it harder to check the type of exception.
A solution is to just avoid the broken synchronous MinioClient
wrapper and use MinioAsyncClient
directly; at the cost of having to call .get()
yourself and having to check exception causes yourself.
A header you provided implies functionality that is not implemented? anyone met this problem when use the .startAfter() for querying objects