Skip to content

Commit ff584cc

Browse files
committed
feat: 增强连接命令的错误处理,添加沙盒生命周期结束的提示信息
1 parent acf2b15 commit ff584cc

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

packages/js-sdk/src/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class SandboxError extends Error {
2929
*
3030
* The [deadline_exceeded] error type is caused by exceeding the timeout for command execution, watch, etc.
3131
*
32-
* The [unknown] error type is sometimes caused by the sandbox timeout when the request is not processed correctly.
32+
* It may also occur because the sandbox has reached the end of its lifecycle.
3333
*/
3434
export class TimeoutError extends SandboxError {
3535
constructor(message: string, stackTrace?: string) {

src/commands/sandbox/connect.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ export const connectCommand = new commander.Command('connect')
2424
process.exit(0)
2525
} catch (err: any) {
2626
console.error(err)
27+
const message =
28+
typeof err?.message === 'string' ? err.message : String(err)
29+
if (/unknown[_ ]error/i.test(message)) {
30+
console.error(
31+
'Connection closed, it might be because the sandbox has reached the end of its lifecycle.'
32+
)
33+
}
2734
process.exit(1)
2835
}
2936
})

0 commit comments

Comments
 (0)