Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dist/lib/integrations/pg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
]);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/integrations/pg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
]);
}
Expand Down