Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better error handling #1

Merged
merged 1 commit into from Sep 16, 2016
Merged

better error handling #1

merged 1 commit into from Sep 16, 2016

Conversation

olalonde
Copy link
Contributor

No description provided.

@@ -44,7 +44,7 @@ app.get('/new/*', function(req, res, next) {

var url = req.url.replace('/new/','');

urlConverter.shortenURL(url).then(obj=> {return res.json(obj);});
urlConverter.shortenURL(url).then(obj=> {return res.json(obj);}).catch(next);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pass error to next

@juanlet juanlet merged commit ad65148 into juanlet:master Sep 16, 2016
var id=req.params.id;
urlConverter.redirectToShortURL(id,res);
urlConverter.redirectToShortURL(id,res, next);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pass error to next

mongo.connect(process.env.MONGOLAB_URI || 'mongodb://localhost:27017/urls',function(err,db){
assert.equal(null,err);
if (err) return cb(err)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pass error to callback

db.collection('urls').findOne({ urlNumber : id }, (err, document)=> {
if (err) return cb(err)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pass error to callback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants