Skip to content

Handle Gateway links #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 18, 2023
Prev Previous commit
Next Next commit
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.
  • Loading branch information
code-asher committed Aug 7, 2023
commit 5569d46a69e8845dad5dc9d4e118f10ab2078c3f
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class CoderRemoteConnectionHandle {
// indicator.text2 is the text below the progress bar.
indicator.text2 =
if (isWorkerTimeout(e)) "Failed to upload worker binary...it may have timed out"
else e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
else e.message ?: e.javaClass.simpleName
},
onCountdown = { remainingMs ->
indicator.text = CoderGatewayBundle.message("gateway.connector.coder.connecting.failed.retry", humanizeDuration(remainingMs))
Expand All @@ -84,14 +84,14 @@ class CoderRemoteConnectionHandle {
recentConnectionsService.addRecentConnection(parameters.toRecentWorkspaceConnection())
} catch (e: Exception) {
if (isCancellation(e)) {
logger.info("Connection canceled due to ${e.javaClass}")
logger.info("Connection canceled due to ${e.javaClass.simpleName}")
} else {
logger.info("Failed to connect (will not retry)", e)
logger.error("Failed to connect (will not retry)", e)
// The dialog will close once we return so write the error
// out into a new dialog.
ApplicationManager.getApplication().invokeAndWait {
Messages.showMessageDialog(
e.message ?: CoderGatewayBundle.message("gateway.connector.no-details"),
e.message ?: e.javaClass.simpleName,
CoderGatewayBundle.message("gateway.connector.coder.connection.failed"),
Messages.getErrorIcon())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class CoderLocateRemoteProjectStepView(private val setNextButtonEnabled: (Boolea
cbIDEComment.foreground = UIUtil.getErrorForeground()
cbIDEComment.text =
if (isWorkerTimeout(e)) "Failed to upload worker binary...it may have timed out. Check the command log for more details."
else e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
else e.message ?: e.javaClass.simpleName
},
onCountdown = { remainingMs ->
cbIDE.renderer = IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.retrieve-ides.failed.retry", humanizeDuration(remainingMs)))
Expand All @@ -225,11 +225,11 @@ class CoderLocateRemoteProjectStepView(private val setNextButtonEnabled: (Boolea
}
} catch (e: Exception) {
if (isCancellation(e)) {
logger.info("Connection canceled due to ${e.javaClass}")
logger.info("Connection canceled due to ${e.javaClass.simpleName}")
} else {
logger.error("Failed to retrieve IDEs (will not retry)", e)
cbIDEComment.foreground = UIUtil.getErrorForeground()
cbIDEComment.text = e.message ?: CoderGatewayBundle.message("gateway.connector.no-details")
cbIDEComment.text = e.message ?: e.javaClass.simpleName
cbIDE.renderer = IDECellRenderer(CoderGatewayBundle.message("gateway.connector.view.coder.retrieve-ides.failed"), UIUtil.getBalloonErrorIcon())
}
}
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/messages/CoderGatewayBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,3 @@ gateway.connector.settings.enable-binary-directory-fallback.title=Fall back to d
gateway.connector.settings.enable-binary-directory-fallback.comment=Checking this \
box will allow the plugin to fall back to the data directory when the CLI \
directory is not writable.
gateway.connector.no-details="The error did not provide any further details"