nodules / terror

Base error class which will help you organize errors, generate informative logs and as result grep logs more effectively
MIT License
25 stars 7 forks source link

Deprecate Terror.ensureError in favor of Terror.createError #29

Closed narqo closed 8 years ago

narqo commented 9 years ago

closes #28

/cc @kaero

kaero commented 8 years ago

wow

narqo commented 8 years ago

We've discussed this with @ruslankerimov and desided that ensureError is still useful in scenarios like failed promises resolution.

new Promise((resolve, reject) => {
  try {
    data = JSON.parse(sdata);
  } catch(err) {
      return reject(err);
  }
  data.condition ? resolve(data) : reject(AppError.createError(...));
})
.catch(err => throw AppError.ensureError(err, AppError.CODES.UNKNOWN_ERROR));
narqo commented 8 years ago

But this PR has some additional fixes, I'll cherry-pick them to the separate PRs later.