File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
packages/shortest/src/browser/core Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { spawn } from "child_process" ;
2
2
3
- type BashToolError = "timeout" | "network" | "unknown" ;
3
+ type BashToolError = "timeout" | "network" | "unknown" | "unauthorized" ;
4
4
5
5
export class BashTool {
6
6
public async execute ( command : string ) : Promise < Record < string , any > | string > {
7
- console . log ( { command } ) ;
8
-
9
7
return new Promise ( ( resolve , reject ) => {
10
8
const child = spawn ( command , { shell : true } ) ;
11
9
@@ -45,9 +43,15 @@ export class BashTool {
45
43
/**
46
44
* Check the type of error from the provided stderr buffer
47
45
* @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 )
49
47
*/
50
48
private getErrorType ( data : string ) : BashToolError {
49
+ // Unauthorized error (401) specific to Clerk
50
+ const unauthorizedRegex = / 4 0 1 U n a u t h o r i z e d / i;
51
+ if ( unauthorizedRegex . test ( data ) ) {
52
+ return "unauthorized" ;
53
+ }
54
+
51
55
const timeoutRegex = / t i m e o u t | r e t r y i n g i n | r e q u e s t t i m e d o u t / i;
52
56
if ( timeoutRegex . test ( data ) ) {
53
57
return "timeout" ;
You can’t perform that action at this time.
0 commit comments