Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is multi-catch or typed catch statements anywhere on the ES roadmap? These are really convenient, essentially you do:

  DB.insert(obj).then(result => {
    ...
  }).catch(UnauthorizedError, e => {
      // Will end up here if auth failed
  }).catch(UniqueConstraintError, e => {
      // Will end up here if there's a conflict in the DB
  }).catch(e => {
      // Generic catch-all
  });
The above is at least available in the Bluebird promise API and greatly improves code organization and readability in my opinion.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: