try{ x = await fs.writeFilePromise("Hello, World", "helloworld.txt") console.log("done!") } catch(error) { console.error(error) // or console.log }