RUEMACHINE
RUEMACHINE

Reputation: 411

How to use return in express error handling

Is there a difference in an express application between these 2 pieces of code that calls an error handler?

return next(err); 
next(err); return;

Are they different or same and if different which one is correct/preferred?

Upvotes: 1

Views: 68

Answers (1)

alexmac
alexmac

Reputation: 19607

next doesn't return anything, so these two statements are identical. But the first one is shorter.

Upvotes: 3

Related Questions