Refactor error handling in Bumper, Media, Group, and Junction components to include contextual information
ci / build-backend (push) Successful in 1m35s
ci / build-frontend (push) Successful in 51s
ci / tests (push) Successful in 1m46s
ci / sonar (push) Successful in 4m43s

Updated error definitions in BumperErrors, MediaErrors, GroupErrors, and TemplateErrors to accept a parameter for contextual information, enhancing the clarity of error messages. Refactored related command handlers to utilize these updated error messages, ensuring that users receive specific details about the usage context when attempting to delete resources. Adjusted unit tests to verify the correctness of the new error handling logic.
This commit is contained in:
Leonid Pershin
2026-07-28 13:19:30 +03:00
parent f895e1ddbc
commit f924891f3b
12 changed files with 227 additions and 27 deletions
@@ -49,10 +49,14 @@ public static class TemplateErrors
"Врезка не найдена."
);
public static readonly Error JunctionInUse = Error.Conflict(
"Templates.JunctionInUse",
"Стык используется слотами — сначала отвяжите его."
);
/// <summary>Стык общий, поэтому держать его может слот чужого канала — называем какого.</summary>
public static Error JunctionInUse(string where) =>
Error.Conflict(
"Templates.JunctionInUse",
where.Length > 0
? $"Стык используется ({where}) — сначала отвяжите его там."
: "Стык используется слотами — сначала отвяжите его."
);
public static readonly Error JunctionGroupRequired = Error.Validation(
"Templates.JunctionGroupRequired",