Skip to content

Commit

Permalink
added if condition to fix typeError
Browse files Browse the repository at this point in the history
  • Loading branch information
YaseenAlMufti committed Sep 20, 2021
1 parent d354784 commit 12301fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ exports.execute = async (srcName, query, params = {}, options = {}) => {
console.error("Oracle Adapter: Error while executing query", err);
throw new Error(err.message);
} finally {
await conn.close();
if (conn) await conn.close();
}
};

Expand Down Expand Up @@ -194,7 +194,7 @@ exports.executeMany = async (srcName, query, binds = [], options = {}) => {
console.error("Oracle Adapter: Error while executing query", err);
throw new Error(err.message);
} finally {
await conn.close();
if (conn) await conn.close();
}
};

Expand Down Expand Up @@ -231,7 +231,7 @@ exports.executeStoredProc = async (srcName, storeproc, params = {}, options = {}
console.error("Oracle Adapter: Error while executing query", err);
throw new Error(err.message);
} finally {
await conn.close();
if (conn) await conn.close();
return rows;
}
};
Expand Down Expand Up @@ -300,7 +300,7 @@ exports.executeStandaloneConnection = async (
} catch (ex) {
console.error(`Oracle Adapter: There was an error at the moment of executing oracle query using a standalone connection: ${JSON.stringify(ex)}`);
} finally {
await connection.close();
if (connection) await connection.close();
return result;
}
};

0 comments on commit 12301fa

Please sign in to comment.