Files
DLE/backend/utils/error.js
2025-10-30 22:41:04 +03:00

26 lines
941 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Copyright (c) 2024-2025 Тарабанов Александр Викторович
* All rights reserved.
*
* This software is proprietary and confidential.
* Unauthorized copying, modification, or distribution is prohibited.
*
* For licensing inquiries: info@hb3-accelerator.com
* Website: https://hb3-accelerator.com
* GitHub: https://github.com/VC-HB3-Accelerator
*/
/**
* Создает объект ошибки с указанным сообщением и кодом статуса
* @param {string} message - Сообщение об ошибке
* @param {number} statusCode - HTTP-код статуса (по умолчанию 500)
* @returns {Error} Объект ошибки с дополнительными свойствами
*/
function createError(message, statusCode = 500) {
const error = new Error(message);
error.statusCode = statusCode;
return error;
}
module.exports = { createError };