Skip to content
Snippets Groups Projects
Commit 2f65c5e9 authored by Alexander Olofsson's avatar Alexander Olofsson
Browse files

Log database errors

parent 2d6cedac
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,11 @@ const config = require('../config'); ...@@ -5,6 +5,11 @@ const config = require('../config');
const pool = new Pool(); const pool = new Pool();
pool.on('error', (err) => {
console.log("DB Pool error occured;");
console.log(err);
});
// TODO: Figure out the perfect db layout, or get the one from IDA // TODO: Figure out the perfect db layout, or get the one from IDA
const seed = ` const seed = `
CREATE TABLE IF NOT EXISTS external_users ( CREATE TABLE IF NOT EXISTS external_users (
......
...@@ -40,6 +40,9 @@ router.post('/', async (req, res) => { ...@@ -40,6 +40,9 @@ router.post('/', async (req, res) => {
try { try {
const queryText = 'INSERT INTO external_users(id, owner_id, username, date_added) VALUES($1, $2, $3, NOW())'; const queryText = 'INSERT INTO external_users(id, owner_id, username, date_added) VALUES($1, $2, $3, NOW())';
await db.query(queryText, [data.id, req.user.id, data.username]); await db.query(queryText, [data.id, req.user.id, data.username]);
} catch(err) {
console.log("> DB Error:");
console.log(err);
} }
res.send(data); res.send(data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment