Commit 248534d4 authored by Sebastian Mihalache's avatar Sebastian Mihalache
Browse files

fix(invite-reviewers): add logger to invite reviewers

parent ef63774d
const logger = require('@pubsweet/logger')
const {
Team,
User,
......@@ -151,6 +153,9 @@ module.exports = models => async (req, res) => {
}
if (isPublons && process.env.PUBLONS_MOCK_EMAIL) {
logger.debug(
`PUBLONS MOCK EMAIL IS SET TO: ${process.env.PUBLONS_MOCK_EMAIL}`,
)
const mockEmail = process.env.PUBLONS_MOCK_EMAIL
userData.email = mockEmail.replace(
'__NAME__',
......@@ -160,11 +165,13 @@ module.exports = models => async (req, res) => {
let newUser
try {
logger.debug(`USER DATA: ${JSON.stringify(userData)}`)
newUser = await userHelper.createUser({
role,
body: userData,
})
} catch (e) {
logger.error(e.message)
return res
.status(400)
.json({ error: `User already exists with email: ${userData.email}` })
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment