mirror of
https://github.com/jambonz/jambonz-api-server.git
synced 2026-01-25 02:08:24 +00:00
further changes, migrate to mysql2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const mysql = require('mysql');
|
||||
const mysql = require('mysql2');
|
||||
const config = require('config');
|
||||
const pool = mysql.createPool(config.get('mysql'));
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ function sysError(logger, res, err) {
|
||||
logger.info(err, 'unprocessable request');
|
||||
return res.status(422).json({msg: err.message});
|
||||
}
|
||||
if (err.message.includes('ER_DUP_ENTRY')) {
|
||||
if (err.code === 'ER_DUP_ENTRY') {
|
||||
logger.info(err, 'duplicate entry on insert');
|
||||
return res.status(422).json({msg: err.message});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user