UNPKG

@piggly/fastify-chassis

Version:

An ESM/CommonJS toolkit to help you to do common operations in your back-end applications with Fastify and NodeJS.

31 lines 1.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TooManyRequestsError = void 0; const ddd_toolkit_1 = require("@piggly/ddd-toolkit"); /** * @file This error should be thrown when the rate limit is exceeded. * @since 5.5.0 * @copyright Piggly Lab 2025 * @author Caique Araujo <caique@piggly.com.br> */ class TooManyRequestsError extends ddd_toolkit_1.ApplicationError { /** * Create a new error. * Useful for: Too many requests. * Code: 2473277220 * * It is not an default Error class, it is a domain error. * Should be not thrown, but used as a domain error. * You may use it to return in a Result object from @piggly/ddd-toolkit. * * @param {string} after The time to retry. * @memberof TooManyRequestsError * @since 1.0.0 * @author Caique Araujo <caique@piggly.com.br> */ constructor(after) { super('TooManyRequestsError', 'Too many requests.', 429, `Rate limit exceeded. Retry in ${after}.`); } } exports.TooManyRequestsError = TooManyRequestsError; //# sourceMappingURL=TooManyRequestsError.js.map