1515 */
1616
1717import { Constructor , ItemDisposalFunc , ShouldDisposeFunc } from "../../types" ;
18- import { logger } from "../../../logutils" ;
1918import { ExpirationCache } from "./expiration_cache" ;
2019import { Topology } from "../../host_list_provider/topology" ;
20+ import { AwsWrapperError } from "../errors" ;
21+ import { Messages } from "../messages" ;
2122
2223const DEFAULT_CLEANUP_INTERVAL_NANOS = 5 * 60 * 1_000_000_000 ; // 5 minutes
2324
@@ -165,7 +166,7 @@ export class StorageServiceImpl implements StorageService {
165166 if ( ! cache ) {
166167 const supplier = StorageServiceImpl . defaultCacheSuppliers . get ( itemClass ) ;
167168 if ( ! supplier ) {
168- throw new Error ( `StorageServiceImpl: Item class not registered: ${ itemClass . name } ` ) ;
169+ throw new AwsWrapperError ( Messages . get ( "StorageService.itemClassNotRegistered" , itemClass . name ) ) ;
169170 }
170171 cache = supplier ( ) ;
171172 this . caches . set ( itemClass , cache ) ;
@@ -174,18 +175,10 @@ export class StorageServiceImpl implements StorageService {
174175 try {
175176 cache . put ( key , item ) ;
176177 } catch ( error ) {
177- throw new Error ( `StorageServiceImpl: Unexpected value mismatch for ${ itemClass . name } : ${ error } ` ) ;
178+ throw new AwsWrapperError ( Messages . get ( "StorageService.unexpectedValueMismatch" , itemClass . name , String ( error ) ) ) ;
178179 }
179180 }
180181
181- getAll < V > ( itemClass : Constructor < V > ) : ExpirationCache < unknown , unknown > | null {
182- const cache = this . caches . get ( itemClass ) ;
183- if ( ! cache ) {
184- return null ;
185- }
186- return cache ;
187- }
188-
189182 get < V > ( itemClass : Constructor < V > , key ?: unknown ) : V | null {
190183 const cache = this . caches . get ( itemClass ) ;
191184 if ( ! cache ) {
@@ -201,7 +194,6 @@ export class StorageServiceImpl implements StorageService {
201194 return value as V ;
202195 }
203196
204- logger . debug ( `StorageServiceImpl: Item class mismatch for key ${ String ( key ) } : ` + `expected ${ itemClass . name } , got ${ value . constructor . name } ` ) ;
205197 return null ;
206198 }
207199
0 commit comments