pjs.fiber.runPromiseNoFail()





This API is deprecated, starting in Profound.js 6. If running Profound.js 6 or higher, use async/await instead. See here for an example.

This API calls a Promise function in a top-down manner within a fiber. If the promise is rejected, the error is attached to the return value.

Parameter

  • JavaScript promise object

Return Value

An object with the following properties:

  • success (true or false)

  • error (error object if success is false)

  • output (response output if success is true)

Exception Handling

No exceptions are thrown by this API.

Example

Run readFile Promise in a fiber
const readFile = require('fs-readfile-promise'); var response = pjs.fiber.runPromiseNoFail(readFile('./myfile')); var fileContent = ""; if (response.success) fileContent = response.output; else console.log(response.error);