Skip to content

Instantly share code, notes, and snippets.

@danoctavian
Last active April 21, 2019 04:01
Show Gist options
  • Save danoctavian/c823323d356d93b5349756ee88e68472 to your computer and use it in GitHub Desktop.
Save danoctavian/c823323d356d93b5349756ee88e68472 to your computer and use it in GitHub Desktop.
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