You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to set some Data items in the exception initially that can be pulled out when/if an exception is thrown. Like attaching metadata to a potential exception. However, when it comes time to call .ThrowIfContainsErrors(); it will throw because the Data count is > 0.
public class UserValidationException : Xeption
{
public UserValidationException(Exception innerException)
: base(message: "User validation errors occurred, please try again.", innerException)
{
Data.Add("StatusCode", StatusCodes.Status400BadRequest);
Data.Add("ErrorCode", 400.01);
}
}
Is this approach just bad, is there a way to already do this, or would it be useful to have a whitelisted list of keys that the ThrowIfContainsErrors will ignore?
I want to be able to set some Data items in the exception initially that can be pulled out when/if an exception is thrown. Like attaching metadata to a potential exception. However, when it comes time to call
.ThrowIfContainsErrors();
it will throw because the Data count is > 0.Is this approach just bad, is there a way to already do this, or would it be useful to have a whitelisted list of keys that the
ThrowIfContainsErrors
will ignore?Something like:
and behind the scenes the methods for checking the Data within Xeption will ignore those keys.
The text was updated successfully, but these errors were encountered: