Skip to content

Compatibility with promises #974

@calebmer

Description

@calebmer

Does restify support catching errors from promises? For example, I'm using babel and async/await functions so most of my middleware functions end up looking like the following:

Server.get('/route', async function (req, res, next) {
  throw new Error('Yikes!')
})

This roughly translates to the following ES5 code:

Server.get('/route', function (req, res, next) {
  return new Promise(function (resolve, reject) {
    reject(new Error('Yikes!'))
  })
})

Does restify catch these errors and output them to the client?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions