Refactor error handling in Bumper, Media, Group, and Junction components to include contextual information
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:
@@ -156,7 +156,7 @@ public class JunctionHandlersTests
|
||||
new DeleteJunctionCommand(junctionId),
|
||||
CancellationToken.None
|
||||
);
|
||||
Assert.Equal(TemplateErrors.JunctionInUse, used.Error);
|
||||
Assert.Equal(TemplateErrors.JunctionInUse(string.Empty).Code, used.Error.Code);
|
||||
}
|
||||
|
||||
// Снимаем ссылку слота, но оставляем стыком по умолчанию — удалять всё равно нельзя.
|
||||
@@ -189,7 +189,7 @@ public class JunctionHandlersTests
|
||||
new DeleteJunctionCommand(junctionId),
|
||||
CancellationToken.None
|
||||
);
|
||||
Assert.Equal(TemplateErrors.JunctionInUse, asDefault.Error);
|
||||
Assert.Equal(TemplateErrors.JunctionInUse(string.Empty).Code, asDefault.Error.Code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user