How to use the common-errors.HttpStatusError function in common-errors

To help you get started, we’ve selected a few common-errors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ubiq / shokku / src / server / services / blacklist.js View on Github external
async blacklist() {
    l.info('BlacklistService - blacklist() / Performing request to fetch blacklists!')
    try {
      const res = await axios(BLACKLIST_RESOURCE_URL)
      return { blacklist: res.data }
    } catch (err) {
      l.error(`BlacklistService - blacklist() / ${err}`)
      throw new errors.HttpStatusError(502, "Can't retrieve blacklist resource from Github. Please, try again later.")
    }
  }
}