More informative QueryInterruptedException toString() (#4642)

* More informative QueryInterruptedException toString()

* Use StringUtils.format
This commit is contained in:
Jonathan Wei 2017-08-04 16:00:20 -07:00 committed by Fangjin Yang
parent 9650d80f3e
commit aa8d75004c
1 changed files with 13 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package io.druid.query;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.druid.java.util.common.StringUtils;
import java.util.concurrent.CancellationException;
import java.util.concurrent.TimeoutException;
@ -109,6 +110,18 @@ public class QueryInterruptedException extends RuntimeException
return host;
}
@Override
public String toString()
{
return StringUtils.format(
"QueryInterruptedException{msg=%s, code=%s, class=%s, host=%s}",
getMessage(),
errorCode,
errorClass,
host
);
}
private static String getErrorCodeFromThrowable(Throwable e)
{
if (e instanceof QueryInterruptedException) {