22import type { DatabaseSync } from "node:sqlite" ;
33import type { FSWatcher } from "chokidar" ;
44import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-runtime" ;
5- import { formatErrorMessage , readErrorName } from "openclaw/plugin-sdk/error-runtime" ;
5+ import {
6+ formatErrorMessage ,
7+ readErrorName ,
8+ toErrorObject ,
9+ } from "openclaw/plugin-sdk/error-runtime" ;
610import { listRegisteredMemoryEmbeddingProviderAdapters } from "openclaw/plugin-sdk/memory-core-host-embedding-registry" ;
711import { classifyMemoryMultimodalPath } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings" ;
812import {
@@ -972,7 +976,7 @@ export class MemoryIndexManager extends MemoryManagerEmbeddingOps implements Mem
972976 }
973977 }
974978 if ( closeFailed ) {
975- throw toLintErrorObject ( firstError , "Embedding provider retirement failed" ) ;
979+ throw toErrorObject ( firstError , "Embedding provider retirement failed" ) ;
976980 }
977981 } ) ;
978982 this . providerRetirementPromise = retirement ;
@@ -2331,7 +2335,7 @@ export class MemoryIndexManager extends MemoryManagerEmbeddingOps implements Mem
23312335 private async retryFailedClose ( ) : Promise < void > {
23322336 const retirementErrors = await this . drainPendingProviderRetirements ( ) ;
23332337 if ( this . providersPendingRetirement . size > 0 ) {
2334- throw toLintErrorObject ( retirementErrors . at ( - 1 ) , "Embedding provider retirement failed" ) ;
2338+ throw toErrorObject ( retirementErrors . at ( - 1 ) , "Embedding provider retirement failed" ) ;
23352339 }
23362340 if ( INDEX_CACHE . get ( this . cacheKey ) === this ) {
23372341 INDEX_CACHE . delete ( this . cacheKey ) ;
@@ -2446,7 +2450,7 @@ export class MemoryIndexManager extends MemoryManagerEmbeddingOps implements Mem
24462450 ( this . providersPendingRetirement . size > 0 ? retirementErrors . at ( - 1 ) : undefined ) ??
24472451 closeErrors . values ( ) . next ( ) . value ;
24482452 if ( closeError ) {
2449- throw toLintErrorObject ( closeError , "Non-Error thrown" ) ;
2453+ throw toErrorObject ( closeError , "Non-Error thrown" ) ;
24502454 }
24512455 if ( INDEX_CACHE . get ( this . cacheKey ) === this ) {
24522456 INDEX_CACHE . delete ( this . cacheKey ) ;
@@ -2461,17 +2465,4 @@ function hasTargetedSessionSyncParams(params: MemorySyncParams | undefined): boo
24612465 ) ;
24622466}
24632467
2464- function toLintErrorObject ( value : unknown , fallbackMessage : string ) : Error {
2465- if ( value instanceof Error ) {
2466- return value ;
2467- }
2468- if ( typeof value === "string" ) {
2469- return new Error ( value ) ;
2470- }
2471- const error = new Error ( fallbackMessage , { cause : value } ) ;
2472- if ( ( typeof value === "object" && value !== null ) || typeof value === "function" ) {
2473- Object . assign ( error , value ) ;
2474- }
2475- return error ;
2476- }
24772468/* oxlint-disable max-lines -- TODO: split this grandfathered oversized file. */
0 commit comments