Skip to content

Commit 5569d46

Browse files
committed
Use exception class name when there is no message
Some exceptions have no message, like null pointer exceptions. Showing the class name seems more helpful than "no details", since it can save you a trip to the logs.
1 parent 78a8df4 commit 5569d46

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/main/kotlin/com/coder/gateway/CoderRemoteConnectionHandle.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class CoderRemoteConnectionHandle {
6868
// indicator.text2 is the text below the progress bar.
6969
indicator.text2 =
7070
if (isWorkerTimeout(e)) "Failed to upload worker binary...it may have timed out"
71-
else e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
71+
else e.message ?: e.javaClass.simpleName
7272
},
7373
onCountdown = { remainingMs ->
7474
indicator.text = CoderGatewayBundle.message("gateway.connector.coder.connecting.failed.retry", humanizeDuration(remainingMs))
@@ -84,14 +84,14 @@ class CoderRemoteConnectionHandle {
8484
recentConnectionsService.addRecentConnection(parameters.toRecentWorkspaceConnection())
8585
} catch (e: Exception) {
8686
if (isCancellation(e)) {
87-
logger.info("Connection canceled due to ${e.javaClass}")
87+
logger.info("Connection canceled due to ${e.javaClass.simpleName}")
8888
} else {
89-
logger.info("Failed to connect (will not retry)", e)
89+
logger.error("Failed to connect (will not retry)", e)
9090
// The dialog will close once we return so write the error
9191
// out into a new dialog.
9292
ApplicationManager.getApplication().invokeAndWait {
9393
Messages.showMessageDialog(
94-
e.message ?: CoderGatewayBundle.message("gateway.connector.no-details"),
94+
e.message ?: e.javaClass.simpleName,
9595
CoderGatewayBundle.message("gateway.connector.coder.connection.failed"),
9696
Messages.getErrorIcon())
9797
}

src/main/kotlin/com/coder/gateway/views/steps/CoderLocateRemoteProjectStepView.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ class CoderLocateRemoteProjectStepView(private val setNextButtonEnabled: (Boolea
213213
cbIDEComment.foreground = UIUtil.getErrorForeground()
214214
cbIDEComment.text =
215215
if (isWorkerTimeout(e)) "Failed to upload worker binary...it may have timed out. Check the command log for more details."
216-
else e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
216+
else e.message ?: e.javaClass.simpleName
217217
},
218218
onCountdown = { remainingMs ->
219219
cbIDE.renderer = IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.retrieve-ides.failed.retry", humanizeDuration(remainingMs)))
@@ -225,11 +225,11 @@ class CoderLocateRemoteProjectStepView(private val setNextButtonEnabled: (Boolea
225225
}
226226
} catch (e: Exception) {
227227
if (isCancellation(e)) {
228-
logger.info("Connection canceled due to ${e.javaClass}")
228+
logger.info("Connection canceled due to ${e.javaClass.simpleName}")
229229
} else {
230230
logger.error("Failed to retrieve IDEs (will not retry)", e)
231231
cbIDEComment.foreground = UIUtil.getErrorForeground()
232-
cbIDEComment.text = e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
232+
cbIDEComment.text = e.message ?: e.javaClass.simpleName
233233
cbIDE.renderer = IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.retrieve-ides.failed"), UIUtil.getBalloonErrorIcon())
234234
}
235235
}

src/main/resources/messages/CoderGatewayBundle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,3 @@ gateway.connector.settings.enable-binary-directory-fallback.title=Fall back to d
8787
gateway.connector.settings.enable-binary-directory-fallback.comment=Checking this \
8888
box will allow the plugin to fall back to the data directory when the CLI \
8989
directory is not writable.
90-
gateway.connector.no-details="The error did not provide any further details"

0 commit comments

Comments
 (0)