Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Commit

Permalink
Fix catch
Browse files Browse the repository at this point in the history
  • Loading branch information
shreychowdhary committed Feb 23, 2018
1 parent d89b664 commit c9b0cbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions api/v1/controllers/RecruiterInterestController.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ function createInterest(req, res, next) {
services.RegistrationService
.findAttendeeById(req.body.attendeeUserId, false)
.then((attendee) => {
services.RecruiterInterestService
return services.RecruiterInterestService
.createInterest(req.user.get('id'), attendee.get('id'), req.body.comments, req.body.favorite)
.then((result) => {
res.body = result.toJSON();
return next();
});
.catch((error) => next(error));
})

.catch((error) => next(error));
}

function getRecruitersInterests(req, res, next) {
Expand Down
4 changes: 2 additions & 2 deletions api/v1/services/RecruiterInterestService.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ module.exports.createInterest = (recruiterId, attendeeId, comments, favorite) =>
return interest
.validate()
.catch(utils.errors.handleValidationError)
.then(() => interest.save());
.then(() => interest.save())
.catch(
utils.errors.DuplicateEntryError,
utils.errors.handleDuplicateEntryError('An interest with the given attendee and recruiter exists', 'attendeeUserId')
utils.errors.handleDuplicateEntryError('An interest with the given attendee and recruiter exists', 'attendeeUserId'));

};

Expand Down

0 comments on commit c9b0cbb

Please sign in to comment.