Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = function fetchRecords() {
- return openConnection()
- .then(fetchRecords)
- .then(groupById)
- .catch(rethrow)
- .done(closeConnection);
- }
- function closeConnection(result) {
- releaseConnection();
- return result;
- }
- resource.fetchRecords().then(/*do something else*/);
- resource
- .openConnection()
- .then(resource.fetchRecords)
- .then(/*do something else*/)
- .catch(/*..*/)
- .end(resource.close)
- module.exports = function fetchRecords() {
- return openConnection()
- .then(fetchRecords)
- .then(groupById)
- .then(closeConnection)
- .catch(rethrow);
- }
- module.exports = function fetchRecords() {
- return openConnection()
- .then(fetchRecords)
- .then(groupById)
- .catch(rethrow)
- .finally(closeConnection);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement