File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,10 @@ function alignContinuation(text: string): string {
2222
2323function enhanceHint ( err : BailianError ) : string | undefined {
2424 if ( err . exitCode === ExitCode . AUTH ) {
25- if ( err . message === CONSOLE_GATEWAY_NO_TOKEN_MESSAGE ) {
25+ if (
26+ err . message === CONSOLE_GATEWAY_NO_TOKEN_MESSAGE ||
27+ err . hint ?. includes ( "auth login --console" )
28+ ) {
2629 return err . hint ;
2730 }
2831 return [
Original file line number Diff line number Diff line change @@ -78,10 +78,19 @@ export async function callConsoleGateway(
7878
7979 const innerData = json . data as Record < string , unknown > | undefined ;
8080 if ( innerData ?. success === false && innerData . errorCode ) {
81+ const errorCode = String ( innerData . errorCode ) ;
82+ const notLogined = errorCode . includes ( "NotLogined" ) ;
83+ const errorMsg = typeof innerData . errorMsg === "string" ? innerData . errorMsg : undefined ;
8184 throw new BailianError (
82- `Console gateway error: ${ innerData . errorCode } ` ,
83- ExitCode . GENERAL ,
84- typeof innerData . errorMsg === "string" ? innerData . errorMsg : undefined ,
85+ notLogined
86+ ? "Console session is not logged in or has expired."
87+ : `Console gateway error: ${ errorCode } ` ,
88+ notLogined ? ExitCode . AUTH : ExitCode . GENERAL ,
89+ notLogined
90+ ? "Run `bl auth login --console` to sign in or refresh your console session."
91+ : errorMsg && errorMsg !== errorCode
92+ ? errorMsg
93+ : undefined ,
8594 ) ;
8695 }
8796
You can’t perform that action at this time.
0 commit comments