public static IActionResult ToActionResult(this DomainError error, ILogger log) { return(error switch { ExceptionError eError => eError.ToActionResult(log), ValidationErrors vError => vError.ToActionResult(log), NotFoundError nError => nError.ToActionResult(log), BasicError bError => bError.ToActionResult(log), _ => new InternalServerErrorResult() });