File tree Expand file tree Collapse file tree 2 files changed +39
-2
lines changed
packages/open-next/src/adapters Expand file tree Collapse file tree 2 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ export default class S3Cache {
234
234
} ,
235
235
} as CacheHandlerValue ;
236
236
} else {
237
- error ( "Unknown cache type" , cacheData ) ;
237
+ warn ( "Unknown cache type" , cacheData ) ;
238
238
return null ;
239
239
}
240
240
} catch ( e ) {
@@ -490,7 +490,7 @@ export default class S3Cache {
490
490
) ;
491
491
return result ;
492
492
} catch ( e ) {
493
- error ( "This error can usually be ignored : " , e ) ;
493
+ warn ( "This error can usually be ignored : " , e ) ;
494
494
return { Body : null , LastModified : null } ;
495
495
}
496
496
}
Original file line number Diff line number Diff line change @@ -12,7 +12,44 @@ export function warn(...args: any[]) {
12
12
console . warn ( ...args ) ;
13
13
}
14
14
15
+ interface AwsSdkClientCommandErrorLog {
16
+ clientName : string ;
17
+ commandName : string ;
18
+ error : Error & { Code ?: string } ;
19
+ }
20
+
21
+ type AwsSdkClientCommandErrorInput = Pick <
22
+ AwsSdkClientCommandErrorLog ,
23
+ "clientName" | "commandName"
24
+ > & {
25
+ errorName : string ;
26
+ } ;
27
+
28
+ const DOWNPLAYED_ERROR_LOGS : AwsSdkClientCommandErrorInput [ ] = [
29
+ {
30
+ clientName : "S3Client" ,
31
+ commandName : "GetObjectCommand" ,
32
+ errorName : "NoSuchKey" ,
33
+ } ,
34
+ ] ;
35
+
36
+ const isDownplayedErrorLog = ( errorLog : AwsSdkClientCommandErrorLog ) =>
37
+ DOWNPLAYED_ERROR_LOGS . some (
38
+ ( downplayedInput ) =>
39
+ downplayedInput . clientName === errorLog ?. clientName &&
40
+ downplayedInput . commandName === errorLog ?. commandName &&
41
+ ( downplayedInput . errorName === errorLog ?. error ?. name ||
42
+ downplayedInput . errorName === errorLog ?. error ?. Code ) ,
43
+ ) ;
44
+
15
45
export function error ( ...args : any [ ] ) {
46
+ if (
47
+ args . some ( ( arg : AwsSdkClientCommandErrorLog ) => isDownplayedErrorLog ( arg ) )
48
+ ) {
49
+ warn ( ...args ) ;
50
+ return ;
51
+ }
52
+
16
53
console . error ( ...args ) ;
17
54
}
18
55
You can’t perform that action at this time.
0 commit comments