This repository was archived by the owner on Nov 22, 2025. It is now read-only.

Description
Use just throw and try/catch around awaits:
|
if (this.options.orange == 'orange') { |
|
|
|
// Instead of using `writeFile().then()`, use await: |
|
await fs.writeFile(html, 'Hello world!', 'utf8'); |
|
|
|
let result = await fs.readFile(html, 'utf8'); |
|
|
|
await fs.unlink(html); |
|
|
|
// Resolve this async function with the result: |
|
return result; |
|
|
|
} else { |
|
|
|
throw new Error(`Orange isn’t orange, it’s ${this.options.orange}!`); |
Here's example of just throw:
https://github.com/mhulse/get-tile-url/blob/f79b35889e0ad43fda12053cd1d2a1dcd8ef3b61/index.js#L90