diff --git a/dist/lib/integrations/pg.js b/dist/lib/integrations/pg.js index 711310e4..d697e618 100644 --- a/dist/lib/integrations/pg.js +++ b/dist/lib/integrations/pg.js @@ -30,13 +30,13 @@ class PGIntegration extends integrations_1.RequireIntegration { // If a callback was specified we need to do callback version if (userCallback) { return originalConnectFn.apply(this, [ - err => { + (err, connection) => { if (err) { integration.logFn("[scout/integrations/pg] Connection to Postgres db failed", types_1.LogLevel.Trace); - userCallback(err); + userCallback(err, connection); return; } - userCallback(); + userCallback(undefined, connection); }, ]); } diff --git a/lib/integrations/pg.ts b/lib/integrations/pg.ts index b4003478..8516a7a7 100644 --- a/lib/integrations/pg.ts +++ b/lib/integrations/pg.ts @@ -35,22 +35,22 @@ export class PGIntegration extends RequireIntegration { const originalConnectFn = Client.prototype.connect; const integration = this; - const fn: any = function(this: Client, userCallback?: (err?: Error) => void) { + const fn: any = function(this: Client, userCallback?: (err?: Error, connection?: any) => void) { integration.logFn("[scout/integrations/pg] Connecting to Postgres db...", LogLevel.Trace); // If a callback was specified we need to do callback version if (userCallback) { return originalConnectFn.apply(this, [ - err => { + (err, connection) => { if (err) { integration.logFn( "[scout/integrations/pg] Connection to Postgres db failed", LogLevel.Trace, ); - userCallback(err); + userCallback(err, connection); return; } - userCallback(); + userCallback(undefined, connection); }, ]); }