mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
EA-104729 - IAE: ErrorDiffRequest.<init>
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.intellij.diff.requests;
|
||||
|
||||
import com.intellij.diff.chains.DiffRequestProducer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -32,15 +33,15 @@ public class ErrorDiffRequest extends MessageDiffRequest {
|
||||
}
|
||||
|
||||
public ErrorDiffRequest(@Nullable String title, @NotNull Throwable e) {
|
||||
this(title, e.getMessage(), null, e);
|
||||
this(title, getErrorMessage(e), null, e);
|
||||
}
|
||||
|
||||
public ErrorDiffRequest(@NotNull Throwable e) {
|
||||
this(null, e.getMessage(), null, e);
|
||||
this(null, getErrorMessage(e), null, e);
|
||||
}
|
||||
|
||||
public ErrorDiffRequest(@Nullable DiffRequestProducer producer, @NotNull Throwable e) {
|
||||
this(producer != null ? producer.getName() : null, e.getMessage(), producer, e);
|
||||
this(producer != null ? producer.getName() : null, getErrorMessage(e), producer, e);
|
||||
}
|
||||
|
||||
public ErrorDiffRequest(@Nullable DiffRequestProducer producer, @NotNull String message) {
|
||||
@@ -65,4 +66,10 @@ public class ErrorDiffRequest extends MessageDiffRequest {
|
||||
public Throwable getException() {
|
||||
return myException;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String getErrorMessage(@NotNull Throwable e) {
|
||||
String message = e.getMessage();
|
||||
return StringUtil.isEmptyOrSpaces(message) ? "Error: can't show diff" : message;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user