diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/BaseException.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/BaseException.java index d344b31f6e..92fbe857b2 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/BaseException.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/BaseException.java @@ -11,7 +11,7 @@ public abstract class BaseException extends RuntimeException { private Map contextMap; - private boolean hideStackTraceInLogs = false; + protected boolean hideStackTraceInLogs = false; public BaseException(String message) { super(message); @@ -38,14 +38,4 @@ public abstract class BaseException extends RuntimeException { public abstract String getDownstreamErrorCode(); public abstract String getErrorType(); - - @SuppressWarnings("unchecked") - public T hideStackTraceInLogs() { - hideStackTraceInLogs = true; - return (T) this; - } - - public boolean shouldHideStackTraceInLogs() { - return hideStackTraceInLogs; - } } diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginException.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginException.java index c4d564f3c7..0d2989df2f 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginException.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/exceptions/pluginExceptions/AppsmithPluginException.java @@ -60,4 +60,9 @@ public class AppsmithPluginException extends BaseException { ? AppsmithPluginErrorCode.GENERIC_PLUGIN_ERROR.getCode() : this.error.getAppErrorCode(); } + + public AppsmithPluginException hideStackTraceInLogs() { + hideStackTraceInLogs = true; + return this; + } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithException.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithException.java index fcd26ffe40..195c891a3f 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithException.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithException.java @@ -63,4 +63,9 @@ public class AppsmithException extends BaseException { public String getReferenceDoc() { return this.error.getReferenceDoc(); } + + public AppsmithException hideStackTraceInLogs() { + hideStackTraceInLogs = true; + return this; + } } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/GlobalExceptionHandler.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/GlobalExceptionHandler.java index e421a5d1e5..e261121174 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/GlobalExceptionHandler.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/GlobalExceptionHandler.java @@ -67,7 +67,7 @@ public class GlobalExceptionHandler { } private void doLog(Throwable error) { - if (error instanceof BaseException baseException && baseException.shouldHideStackTraceInLogs()) { + if (error instanceof BaseException baseException && baseException.isHideStackTraceInLogs()) { log.error(baseException.getClass().getSimpleName() + ": " + baseException.getMessage()); } else { log.error("", error);