Skip to content

Commit 15e82eb

Browse files
author
gladysh
committed
bash tool unauthenticated error
1 parent bfc7cf7 commit 15e82eb

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/shortest/src/browser/core/bash-tool.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { spawn } from "child_process";
22

3-
type BashToolError = "timeout" | "network" | "unknown";
3+
type BashToolError = "timeout" | "network" | "unknown" | "unauthorized";
44

55
export class BashTool {
66
public async execute(command: string): Promise<Record<string, any> | string> {
7-
console.log({ command });
8-
97
return new Promise((resolve, reject) => {
108
const child = spawn(command, { shell: true });
119

@@ -45,9 +43,15 @@ export class BashTool {
4543
/**
4644
* Check the type of error from the provided stderr buffer
4745
* @param data Linux / PowerShell stderr buffer
48-
* @returns The type of error (e.g., "timeout", "network", or "unknown")
46+
* @returns The type of error (e.g., "timeout", "network", etc)
4947
*/
5048
private getErrorType(data: string): BashToolError {
49+
// Unauthorized error (401) specific to Clerk
50+
const unauthorizedRegex = /401 Unauthorized/i;
51+
if (unauthorizedRegex.test(data)) {
52+
return "unauthorized";
53+
}
54+
5155
const timeoutRegex = /timeout|retrying in|request timed out/i;
5256
if (timeoutRegex.test(data)) {
5357
return "timeout";

0 commit comments

Comments
 (0)