Last active
April 21, 2019 04:01
-
-
Save danoctavian/c823323d356d93b5349756ee88e68472 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios') | |
;(async () => { | |
const r = await axios.get('https://www.etherchain.org/api/gasPriceOracle') | |
console.log(`root coroutine Oracle answer: ${r.data.standard}`) | |
;(async () => { | |
try { | |
console.log('Running coroutine 0..') | |
const r = await axios.get('https://www.etherchain.org/api/gasPriceOracle') | |
console.log(`coroutine 0 Oracle answer: ${r.data.standard}`) | |
} catch (e) { | |
console.log(`coroutine 1 failed with ${e.stack}`) | |
} | |
})() | |
;(async () => { | |
try { | |
console.log('Running coroutine 1..') | |
const r = await axios.get('https://www.etherchain.org/api/gasPriceOracle') | |
console.log(`coroutine 1 Oracle answer: ${r.data.standard}`) | |
} catch (e) { | |
console.log(`coroutine 1 failed with ${e.stack}`) | |
} | |
})() | |
})().catch(e => console.log(`root coroutine failed with ${e.stack}`)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment