Skip to content

Commit e9bd68e

Browse files
committed
change AuthenticationException log level to debug
1 parent 1ccf50f commit e9bd68e

File tree

1 file changed

+11
-6
lines changed
  • ide-common/src/main/kotlin/org/digma/intellij/plugin/auth

1 file changed

+11
-6
lines changed

ide-common/src/main/kotlin/org/digma/intellij/plugin/auth/AuthManager.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,20 +221,25 @@ class AuthManager : Disposable {
221221

222222
} catch (e: InvocationTargetException) {
223223

224-
Log.warnWithException(logger, e, "Exception in auth proxy {}", ExceptionUtils.getNonEmptyMessage(e))
224+
val authenticationException = ExceptionUtils.find(e, AuthenticationException::class.java)
225+
//log debug on AuthenticationException because it happens a lot, every time the token expires
226+
if (authenticationException == null) {
227+
Log.warnWithException(logger, e, "Exception in auth proxy {}", ExceptionUtils.getNonEmptyMessage(e))
228+
} else {
229+
Log.debugWithException(logger, e, "AuthenticationException in auth proxy {}", ExceptionUtils.getNonEmptyMessage(e))
230+
}
225231

226232
if (isPaused.get()) {
227233
Log.log(logger::trace, "got Exception in auth proxy but proxy is paused, rethrowing")
228234
throw e
229235
}
230236

231237
//check if this is an AuthenticationException, if not rethrow the exception
232-
@Suppress("UNUSED_VARIABLE")
233-
val authenticationException = ExceptionUtils.find(e, AuthenticationException::class.java)
234-
?: throw e
235-
236-
Log.log(logger::trace, "got AuthenticationException, calling onAuthenticationException")
238+
if (authenticationException == null) {
239+
throw e
240+
}
237241

242+
Log.log(logger::trace, "got AuthenticationException {}, calling onAuthenticationException", ExceptionUtils.getNonEmptyMessage(e))
238243
//call onAuthenticationException to refresh or login
239244
onAuthenticationException()
240245

0 commit comments

Comments
 (0)