Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
featured: Boolean(flags.featured),
collection: flags.collection,
orientation: flags.orientation,
});
}
if (photo) {
spinner.succeed('Connected!');
if (Array.isArray(photo)) {
photo = photo[0];
}
if (photo.errors) {
const UnsplashError = new Error('Unsplash Error');
Sentry.setExtra('Unsplash Error', photo.errors);
const event_id = Sentry.captureException(UnsplashError);
config.set('lastEventId', event_id);
return printBlock(chalk`{bold {red ERROR:}}`, ...photo.errors);
}
const { url } = await Unsplash.shared.getDownloadLink(photo.id);
await download(photo, url, flags, true);
} else {
spinner.fail('Unable to connect.');
}
} catch (error) {
return errorHandler(error);
}
} else {
module.exports = async (req, res, next) => {
const installation = res.locals.installation
const { installationId: gitHubInstallationId, syncType } = req.body
Sentry.setExtra('Body', req.body)
try {
const subscription = await Subscription.getSingleInstallation(installation.jiraHost, gitHubInstallationId)
await Subscription.findOrStartSync(subscription, syncType)
return res.sendStatus(202)
} catch (error) {
next(new Error('Unauthorized'))
}
}
Sentry.withScope(async scope => {
const jiraHost = (req && req.session && req.session.jiraHost) || (req && req.query && req.query.xdm_e)
if (jiraHost) {
scope.setTag('jiraHost', jiraHost)
}
if (req.body) {
Sentry.setExtra('Body', req.body)
}
next(err)
})
}