pulsar-edit / package-backend

Pulsar Server Backend for Packages
https://api.pulsar-edit.dev
MIT License
11 stars 11 forks source link

Migrate Existing usage of `common.handleError()` to `common.handleDetailedError()` to provide better Errors #116

Closed confused-Techie closed 4 months ago

confused-Techie commented 1 year ago

Throughout the codebase there are many // TODOs that call for a more specific errors to be returned where possible.

In general these can be replaced by using common.handleDetailedError(). The criteria to find these and implement them properly would be:

The common pattern would be:

logger.generic(3, "Detailed error message only being output to logs.");
await common.handleError(req, res, {
  ok: false,
  short: "Server Error",
  content: "Package Name is banned",
});

Which could then be made into:

await common.handleDetailedError(req, res, {
  ok: false,
  short: "Server Error",
  content: "Detailed error message only being output to logs",
});
confused-Techie commented 4 months ago

This issue has now become outdated, with the endpoint builder taking care of this