I'm working on a fairly standard ASP.NET Core 8 Web API project. I added a module to globally capture exceptions, and it works fine. But now I'm trying to standardize the responses in the controllers more, and I've added a small class to help me with this:
public class ActionResponse<T>
{
public bool WasSuccess { get; set; }
public string? Message { get; set; }
public T? Result { get; set; }
}
So far, nothing unusual. The point is, I'd now like to return that "enhanced message" I'm returning in the global exception in that Message property... perhaps from the same controller or somewhere else, but still in that format (WasSuccess = false, Message = "new error...")... but I don't know at what point or how I could do this.