File tree 3 files changed +9
-8
lines changed
server/aws-lsp-codewhisperer/src
language-server/securityScan
3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -196,9 +196,7 @@ export const SecurityScanServerToken =
196
196
logging . log ( `Security scan failed. ${ error } ` )
197
197
securityScanTelemetryEntry . result = 'Failed'
198
198
const err = getErrorMessage ( error )
199
- const exception = hasConnectionExpired ( error as Error )
200
- ? new AmazonQServiceInvalidConnectionError ( err )
201
- : null
199
+ const exception = hasConnectionExpired ( error ) ? new AmazonQServiceInvalidConnectionError ( err ) : error
202
200
203
201
return {
204
202
status : 'Failed' ,
Original file line number Diff line number Diff line change 1
1
// Base error class for Amazon Q
2
2
export class AmazonQError extends Error {
3
3
public code : string
4
+ override message : string
4
5
constructor ( message : string , code : string ) {
5
6
super ( message )
6
7
this . name = 'AmazonQError'
7
8
this . code = code
9
+ this . message = message
8
10
}
9
11
}
10
12
@@ -65,10 +67,8 @@ export class AmazonQServiceNoProfileSupportError extends AmazonQError {
65
67
}
66
68
67
69
export class AmazonQServiceInvalidConnectionError extends AmazonQError {
68
- override message : string
69
70
constructor ( message : string = 'Current authentication token is expired.' ) {
70
71
super ( message , 'E_AMAZON_Q_INVALID_CONNECTION' )
71
72
this . name = 'AmazonQServiceInvalidConnectionError'
72
- this . message = 'Current authentication token is expired.'
73
73
}
74
74
}
Original file line number Diff line number Diff line change @@ -303,7 +303,10 @@ export function isStringOrNull(object: any): object is string | null {
303
303
return typeof object === 'string' || object === null
304
304
}
305
305
306
- export function hasConnectionExpired ( error : Error ) {
307
- const authFollowType = getAuthFollowUpType ( error )
308
- return authFollowType == 're-auth'
306
+ export function hasConnectionExpired ( error : any ) {
307
+ if ( error instanceof Error ) {
308
+ const authFollowType = getAuthFollowUpType ( error )
309
+ return authFollowType == 're-auth'
310
+ }
311
+ return false
309
312
}
You can’t perform that action at this time.
0 commit comments