MCPcopy
hub / github.com/MagicMirrorOrg/MagicMirror / #createErrorInfo

Method #createErrorInfo

js/http_fetcher.js:260–271  ·  view source on GitHub ↗

* Creates a standardized error info object * @param {string} message - Error message * @param {number|null} status - HTTP status code or null for network errors * @param {string} errorType - Error type: AUTH_FAILURE, RATE_LIMITED, SERVER_ERROR, CLIENT_ERROR, NETWORK_ERROR * @param {number} r

(message, status, errorType, retryAfter, originalError = null)

Source from the content-addressed store, hash-verified

258 * @returns {object} Error info object with translationKey for direct use
259 */
260 #createErrorInfo (message, status, errorType, retryAfter, originalError = null) {
261 return {
262 message,
263 status,
264 errorType,
265 translationKey: ERROR_TYPE_TO_TRANSLATION[errorType] || "MODULE_ERROR_UNSPECIFIED",
266 retryAfter,
267 retryCount: errorType === "NETWORK_ERROR" ? this.networkErrorCount : this.serverErrorCount,
268 url: this.url,
269 originalError
270 };
271 }
272
273 /**
274 * Performs the HTTP fetch and emits appropriate events

Callers 2

#getDelayForResponseMethod · 0.95
fetchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected