-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
25 lines (20 loc) · 625 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var asyncController = require('./modules/async-controller');
asyncController(function* gen() {
try {
var fetchedResult = yield fetchData();
var resultObject = yield fetchedResult.json();
var savedResult = yield saveData(resultObject);
var report = yield saveReport(savedResult);
var responseResult = yield response(report);
console.log(responseResult);
} catch (err) {
console.log('The error is handled here:', err);
}
return "finish";
})
.then(function(result) {
console.log('end message:', result);
})
.catch(function(err) {
console.log('handle the uncaught errors:', err);
});