protected String getExceptionName() { return getExceptionName(this); }
public static Query newLenientFieldQuery(String field, RuntimeException e) { String message = ElasticsearchException.getExceptionName(e) + ":[" + e.getMessage() + "]"; return Queries.newMatchNoDocsQuery("failed [" + field + "] query, caused by " + message); }
/** * Static toXContent helper method that renders {@link org.elasticsearch.ElasticsearchException} or {@link Throwable} instances * as XContent, delegating the rendering to {@link #toXContent(XContentBuilder, Params)} * or {@link #innerToXContent(XContentBuilder, Params, Throwable, String, String, Map, Map, Throwable)}. * * This method is usually used when the {@link Throwable} is rendered as a part of another XContent object, and its result can * be parsed back using the {@link #fromXContent(XContentParser)} method. */ public static void generateThrowableXContent(XContentBuilder builder, Params params, Throwable t) throws IOException { t = ExceptionsHelper.unwrapCause(t); if (t instanceof ElasticsearchException) { ((ElasticsearchException) t).toXContent(builder, params); } else { innerToXContent(builder, params, t, getExceptionName(t), t.getMessage(), emptyMap(), emptyMap(), t.getCause()); } }
public NotSerializableExceptionWrapper(Throwable other) { super(ElasticsearchException.getExceptionName(other) + ": " + other.getMessage(), other.getCause()); this.name = ElasticsearchException.getExceptionName(other); this.status = ExceptionsHelper.status(other); setStackTrace(other.getStackTrace()); for (Throwable otherSuppressed : other.getSuppressed()) { addSuppressed(otherSuppressed); } if (other instanceof ElasticsearchException) { ElasticsearchException ex = (ElasticsearchException) other; for (String key : ex.getHeaderKeys()) { this.addHeader(key, ex.getHeader(key)); } for (String key : ex.getMetadataKeys()) { this.addMetadata(key, ex.getMetadata(key)); } } }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { Throwable ex = ExceptionsHelper.unwrapCause(this); if (ex != this) { generateThrowableXContent(builder, params, this); } else { innerToXContent(builder, params, this, getExceptionName(), getMessage(), headers, metadata, getCause()); } return builder; }
protected String getExceptionName() { return getExceptionName(this); }
protected String getExceptionName() { return getExceptionName(this); }
protected String getExceptionName() { return getExceptionName(this); }
protected String getExceptionName() { return getExceptionName(this); }
public static Query newLenientFieldQuery(String field, RuntimeException e) { String message = ElasticsearchException.getExceptionName(e) + ":[" + e.getMessage() + "]"; return Queries.newMatchNoDocsQuery("failed [" + field + "] query, caused by " + message); }
@Override protected String getExceptionName() { if (getIndex() != null) { // This is only for BWC and is removed in 6.0.0 return "index_already_exists_exception"; } else { return super.getExceptionName(); } } }
public static Query newLenientFieldQuery(String field, RuntimeException e) { String message = ElasticsearchException.getExceptionName(e) + ":[" + e.getMessage() + "]"; return Queries.newMatchNoDocsQuery("failed [" + field + "] query, caused by " + message); }
/** * Static toXContent helper method that renders {@link org.elasticsearch.ElasticsearchException} or {@link Throwable} instances * as XContent, delegating the rendering to {@link #toXContent(XContentBuilder, Params)} * or {@link #innerToXContent(XContentBuilder, Params, Throwable, String, String, Map, Map, Throwable)}. * * This method is usually used when the {@link Throwable} is rendered as a part of another XContent object, and its result can * be parsed back using the {@link #fromXContent(XContentParser)} method. */ public static void generateThrowableXContent(XContentBuilder builder, Params params, Throwable t) throws IOException { t = ExceptionsHelper.unwrapCause(t); if (t instanceof ElasticsearchException) { ((ElasticsearchException) t).toXContent(builder, params); } else { innerToXContent(builder, params, t, getExceptionName(t), t.getMessage(), emptyMap(), emptyMap(), t.getCause()); } }
/** * Static toXContent helper method that renders {@link org.elasticsearch.ElasticsearchException} or {@link Throwable} instances * as XContent, delegating the rendering to {@link #toXContent(XContentBuilder, Params)} * or {@link #innerToXContent(XContentBuilder, Params, Throwable, String, String, Map, Map, Throwable)}. * * This method is usually used when the {@link Throwable} is rendered as a part of another XContent object, and its result can * be parsed back using the {@link #fromXContent(XContentParser)} method. */ public static void generateThrowableXContent(XContentBuilder builder, Params params, Throwable t) throws IOException { t = ExceptionsHelper.unwrapCause(t); if (t instanceof ElasticsearchException) { ((ElasticsearchException) t).toXContent(builder, params); } else { innerToXContent(builder, params, t, getExceptionName(t), t.getMessage(), emptyMap(), emptyMap(), t.getCause()); } }
/** * Static toXContent helper method that renders {@link org.elasticsearch.ElasticsearchException} or {@link Throwable} instances * as XContent, delegating the rendering to {@link #toXContent(XContentBuilder, Params)} * or {@link #innerToXContent(XContentBuilder, Params, Throwable, String, String, Map, Map, Throwable)}. * * This method is usually used when the {@link Throwable} is rendered as a part of another XContent object, and its result can * be parsed back using the {@link #fromXContent(XContentParser)} method. */ public static void generateThrowableXContent(XContentBuilder builder, Params params, Throwable t) throws IOException { t = ExceptionsHelper.unwrapCause(t); if (t instanceof ElasticsearchException) { ((ElasticsearchException) t).toXContent(builder, params); } else { innerToXContent(builder, params, t, getExceptionName(t), t.getMessage(), emptyMap(), emptyMap(), t.getCause()); } }
public NotSerializableExceptionWrapper(Throwable other) { super(ElasticsearchException.getExceptionName(other) + ": " + other.getMessage(), other.getCause()); this.name = ElasticsearchException.getExceptionName(other); this.status = ExceptionsHelper.status(other); setStackTrace(other.getStackTrace()); for (Throwable otherSuppressed : other.getSuppressed()) { addSuppressed(otherSuppressed); } if (other instanceof ElasticsearchException) { ElasticsearchException ex = (ElasticsearchException) other; for (String key : ex.getHeaderKeys()) { this.addHeader(key, ex.getHeader(key)); } } }
/** * Statis toXContent helper method that also renders non {@link org.elasticsearch.ElasticsearchException} instances as XContent. */ public static void toXContent(XContentBuilder builder, Params params, Throwable ex) throws IOException { ex = ExceptionsHelper.unwrapCause(ex); if (ex instanceof ElasticsearchException) { ((ElasticsearchException) ex).toXContent(builder, params); } else { builder.field("type", getExceptionName(ex)); builder.field("reason", ex.getMessage()); if (ex.getCause() != null) { builder.field("caused_by"); builder.startObject(); toXContent(builder, params, ex.getCause()); builder.endObject(); } if (params.paramAsBoolean(REST_EXCEPTION_SKIP_STACK_TRACE, REST_EXCEPTION_SKIP_STACK_TRACE_DEFAULT) == false) { builder.field("stack_trace", ExceptionsHelper.stackTrace(ex)); } } }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { Throwable ex = ExceptionsHelper.unwrapCause(this); if (ex != this) { generateThrowableXContent(builder, params, this); } else { innerToXContent(builder, params, this, getExceptionName(), getMessage(), headers, metadata, getCause()); } return builder; }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { Throwable ex = ExceptionsHelper.unwrapCause(this); if (ex != this) { generateThrowableXContent(builder, params, this); } else { innerToXContent(builder, params, this, getExceptionName(), getMessage(), headers, metadata, getCause()); } return builder; }
@Override public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { Throwable ex = ExceptionsHelper.unwrapCause(this); if (ex != this) { generateThrowableXContent(builder, params, this); } else { innerToXContent(builder, params, this, getExceptionName(), getMessage(), headers, metadata, getCause()); } return builder; }