Skip to content

Commit

Permalink
Merge pull request #75 from maozhen520/hotfix/shield-unnecessary-error
Browse files Browse the repository at this point in the history
Shield unnecessary error notice.
  • Loading branch information
xiangtianyu authored Aug 19, 2024
2 parents fe0f159 + 510ff8e commit e7eaff1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class DevPilotErrorReporter extends ITNReporter {

private final PluginId devpilotPluginId = PluginId.getId("com.zhongan.devPilot");

private static final String READ_ACCESS_ERROR = "Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction())";

/**
* Ignore deprecated method error, in internal model, still receiver warning
Expand All @@ -38,6 +39,7 @@ public class DevPilotErrorReporter extends ITNReporter {
@Override
public boolean showErrorInRelease(IdeaLoggingEvent event) {
boolean isDevpilotDeprecatedUseNotice = false;
boolean isReadAccessError = false;
Throwable t = event.getThrowable();
PluginId pluginId = PluginUtil.getInstance().findPluginId(t);
if (Objects.equals(pluginId, devpilotPluginId)) {
Expand All @@ -50,8 +52,11 @@ public boolean showErrorInRelease(IdeaLoggingEvent event) {
}
}
}
if (StringUtils.containsIgnoreCase(t.getMessage(), READ_ACCESS_ERROR)) {
isReadAccessError = true;
}
}
return !isDevpilotDeprecatedUseNotice;
return !isDevpilotDeprecatedUseNotice && !isReadAccessError;
}

@NotNull
Expand Down

0 comments on commit e7eaff1

Please sign in to comment.