diff --git a/models/mongodb/FHIRDataTypesSchema/time.js b/models/mongodb/FHIRDataTypesSchema/time.js index 1cc15957..af1576ad 100644 --- a/models/mongodb/FHIRDataTypesSchema/time.js +++ b/models/mongodb/FHIRDataTypesSchema/time.js @@ -6,7 +6,6 @@ module.exports = { if (v) { let timeDate = moment(v, "hh:mm:ss.SSS").toDate(); let storeTime = timeDate.getHours() * 3600000 + timeDate.getMinutes() * 60000+ timeDate.getSeconds() * 1000 + timeDate.getMilliseconds(); - console.log(storeTime); return storeTime; } }, diff --git a/server.js b/server.js index 056402ac..97b69618 100644 --- a/server.js +++ b/server.js @@ -2,6 +2,7 @@ const express = require('express'); const bodyParser = require('body-parser'); const http = require('http'); const compress = require('compression'); +const { handleError } = require('./models/FHIR/httpMessage'); //login const cookieParser = require('cookie-parser'); const passport = require('passport'); @@ -37,13 +38,18 @@ app.use((err, req, res, next) => { // This check makes sure this is a JSON parsing issue, but it might be // coming from any middleware, not just body-parser: - if (err instanceof SyntaxError && err.status === 400 && 'body' in err) { + // if (err instanceof SyntaxError && err.status === 400 && 'body' in err) { + // console.error(err); + // return res.sendStatus(400); // Bad request + // } + if (err) { console.error(err); - return res.sendStatus(400); // Bad request + return res.status(400).send(handleError.processing(err)); } next(); }); + app.use(cookieParser()); //login app.use(session({