Skip to content

Commit

Permalink
fix: added stack logging to getDatabase
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Jun 18, 2024
1 parent 4f90037 commit a75cdc6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ Logs.pre('validate', function (next) {
next();
});

/*
// NOTE: this deletes object references for p-retry
// we are removing in the interim
// safeguard for sensitive stuff
Logs.pre('save', function (next) {
// delete err.payload.user.password (safeguard)
Expand All @@ -316,6 +319,7 @@ Logs.pre('save', function (next) {
next();
});
*/

//
// NOTE: this comes after validate because validation ensures `required: true`
Expand Down
4 changes: 4 additions & 0 deletions helpers/get-database.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ async function getDatabase(
newlyCreated = false,
customDbFilePath = false
) {
const { stack } = new Error('stack');
// return early if the session.db was already assigned
if (
session.db &&
Expand Down Expand Up @@ -566,6 +567,9 @@ async function getDatabase(
}
}
} catch (err) {
err._stack = stack;
err.session = session;

if (
err.code !== 'SQLITE_ERROR' ||
!err.message.startsWith('no such table:')
Expand Down

0 comments on commit a75cdc6

Please sign in to comment.