Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20e7ee6

Browse files
committed
Refactor error message for use with Toolbox
1 parentc9ec768 commit20e7ee6

File tree

2 files changed

+12
-55
lines changed

2 files changed

+12
-55
lines changed
Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
packagecom.coder.gateway.util
22

3-
importcom.coder.gateway.CoderGatewayBundle
43
importcom.coder.gateway.cli.ex.ResponseException
54
importcom.coder.gateway.sdk.ex.APIResponseException
65
importorg.zeroturnaround.exec.InvalidExitValueException
@@ -11,56 +10,25 @@ import java.net.UnknownHostException
1110
importjavax.net.ssl.SSLHandshakeException
1211

1312
funhumanizeConnectionError(deploymentURL:URL,requireTokenAuth:Boolean,e:Exception):String {
14-
val reason= e.message?:CoderGatewayBundle.message("gateway.connector.view.workspaces.connect.no-reason")
13+
val reason= e.message?:"Noreason was provided."
1514
returnwhen (e) {
16-
is java.nio.file.AccessDeniedException->
17-
CoderGatewayBundle.message(
18-
"gateway.connector.view.workspaces.connect.access-denied",
19-
e.file,
20-
)
21-
isUnknownHostException->
22-
CoderGatewayBundle.message(
23-
"gateway.connector.view.workspaces.connect.unknown-host",
24-
e.message?: deploymentURL.host,
25-
)
26-
isInvalidExitValueException->
27-
CoderGatewayBundle.message(
28-
"gateway.connector.view.workspaces.connect.unexpected-exit",
29-
e.exitValue,
30-
)
15+
is java.nio.file.AccessDeniedException->"Access denied to${e.file}."
16+
isUnknownHostException->"Unknown host${e.message?: deploymentURL.host}."
17+
isInvalidExitValueException->"CLI exited unexpectedly with${e.exitValue}."
3118
isAPIResponseException-> {
3219
if (e.isUnauthorized) {
33-
CoderGatewayBundle.message(
34-
if (requireTokenAuth) {
35-
"gateway.connector.view.workspaces.connect.unauthorized-token"
36-
}else {
37-
"gateway.connector.view.workspaces.connect.unauthorized-other"
38-
},
39-
deploymentURL,
40-
)
20+
if (requireTokenAuth) {
21+
"Token was rejected by$deploymentURL; has your token expired?"
22+
}else {
23+
"Authorization failed to$deploymentURL."
24+
}
4125
}else {
4226
reason
4327
}
4428
}
45-
isSocketTimeoutException-> {
46-
CoderGatewayBundle.message(
47-
"gateway.connector.view.workspaces.connect.timeout",
48-
deploymentURL,
49-
)
50-
}
51-
isResponseException,isConnectException-> {
52-
CoderGatewayBundle.message(
53-
"gateway.connector.view.workspaces.connect.download-failed",
54-
reason,
55-
)
56-
}
57-
isSSLHandshakeException-> {
58-
CoderGatewayBundle.message(
59-
"gateway.connector.view.workspaces.connect.ssl-error",
60-
deploymentURL.host,
61-
reason,
62-
)
63-
}
29+
isSocketTimeoutException->"Unable to connect to$deploymentURL; is it up?"
30+
isResponseException,isConnectException->"Failed to download Coder CLI:$reason"
31+
isSSLHandshakeException->"Connection to$deploymentURL failed:$reason. See the <a href='https://coder.com/docs/v2/latest/ides/gateway#configuring-the-gateway-plugin-to-use-internal-certificates'>documentation for TLS certificates</a> for information on how to make your system trust certificates coming from your deployment."
6432
else-> reason
6533
}
6634
}

‎src/main/resources/messages/CoderGatewayBundle.properties

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@ gateway.connector.view.coder.workspaces.invalid.coder.version=Could not parse Co
3232
gateway.connector.view.coder.workspaces.unsupported.coder.version=Coder version {0} might not be compatible with this plugin version. <ahref='https://coder.com/docs/v2/latest/ides/gateway#creating-a-new-jetbrains-gateway-connection'>Connect to a Coder workspace manually</a>
3333
gateway.connector.view.workspaces.connect.failed=Connection to {0} failed. See above for details.
3434
gateway.connector.view.workspaces.connect.canceled=Connection to {0} canceled.
35-
gateway.connector.view.workspaces.connect.no-reason=No reason was provided.
36-
gateway.connector.view.workspaces.connect.access-denied=Access denied to {0}.
37-
gateway.connector.view.workspaces.connect.unknown-host=Unknown host {0}.
38-
gateway.connector.view.workspaces.connect.unexpected-exit=CLI exited unexpectedly with {0}.
39-
gateway.connector.view.workspaces.connect.unauthorized-token=Token was rejected by {0}; has your token expired?
40-
gateway.connector.view.workspaces.connect.unauthorized-other=Authorization failed to {0}.
41-
gateway.connector.view.workspaces.connect.timeout=Unable to connect to {0}; is it up?
42-
gateway.connector.view.workspaces.connect.download-failed=Failed to download Coder CLI: {0}
43-
gateway.connector.view.workspaces.connect.ssl-error=Connection to {0} failed: {1}. See the \
44-
<ahref='https://coder.com/docs/v2/latest/ides/gateway#configuring-the-gateway-plugin-to-use-internal-certificates'>documentation for TLS certificates</a> \
45-
for information on how to make your system trust certificates coming from your deployment.
4635
gateway.connector.view.coder.connect-ssh=Establishing SSH connection to remote worker...
4736
gateway.connector.view.coder.connect-ssh.retry=Establishing SSH connection to remote worker (attempt {0})...
4837
gateway.connector.view.coder.retrieve-ides=Retrieving IDEs...

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp