Skip to content

Commit f34527b

Browse files
committed
refactor: update error logging format in BaseDrizzleAdapter for improved structure and clarity
1 parent 69550de commit f34527b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

packages/plugin-sql/src/base.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,7 +2520,8 @@ export abstract class BaseDrizzleAdapter extends DatabaseAdapter<any> {
25202520
return true;
25212521
} catch (error) {
25222522
logger.error(
2523-
`Error creating relationship: ${error instanceof Error ? error.message : String(error)}, saveParams: ${JSON.stringify(saveParams)}`
2523+
{ src: 'plugin:sql', agentId: this.agentId, error: error instanceof Error ? error.message : String(error), saveParams },
2524+
'Error creating relationship'
25242525
);
25252526
return false;
25262527
}
@@ -2544,7 +2545,8 @@ export abstract class BaseDrizzleAdapter extends DatabaseAdapter<any> {
25442545
.where(eq(relationshipTable.id, relationship.id));
25452546
} catch (error) {
25462547
logger.error(
2547-
`Error updating relationship: ${error instanceof Error ? error.message : String(error)}, relationship: ${JSON.stringify(relationship)}`
2548+
{ src: 'plugin:sql', agentId: this.agentId, error: error instanceof Error ? error.message : String(error), relationshipId: relationship.id },
2549+
'Error updating relationship'
25482550
);
25492551
throw error;
25502552
}
@@ -2654,7 +2656,8 @@ export abstract class BaseDrizzleAdapter extends DatabaseAdapter<any> {
26542656
return undefined;
26552657
} catch (error) {
26562658
logger.error(
2657-
`Error fetching cache: ${error instanceof Error ? error.message : String(error)}, key: ${key}, agentId: ${this.agentId}`
2659+
{ src: 'plugin:sql', agentId: this.agentId, error: error instanceof Error ? error.message : String(error), key },
2660+
'Error fetching cache'
26582661
);
26592662
return undefined;
26602663
}
@@ -2687,7 +2690,8 @@ export abstract class BaseDrizzleAdapter extends DatabaseAdapter<any> {
26872690
return true;
26882691
} catch (error) {
26892692
logger.error(
2690-
`Error setting cache: ${error instanceof Error ? error.message : String(error)}, key: ${key}, agentId: ${this.agentId}`
2693+
{ src: 'plugin:sql', agentId: this.agentId, error: error instanceof Error ? error.message : String(error), key },
2694+
'Error setting cache'
26912695
);
26922696
return false;
26932697
}
@@ -2710,7 +2714,8 @@ export abstract class BaseDrizzleAdapter extends DatabaseAdapter<any> {
27102714
return true;
27112715
} catch (error) {
27122716
logger.error(
2713-
`Error deleting cache: ${error instanceof Error ? error.message : String(error)}, key: ${key}, agentId: ${this.agentId}`
2717+
{ src: 'plugin:sql', agentId: this.agentId, error: error instanceof Error ? error.message : String(error), key },
2718+
'Error deleting cache'
27142719
);
27152720
return false;
27162721
}

0 commit comments

Comments
 (0)