Add error message if no valid day was found
continuous-integration/drone/push Build is passing Details

pull/2/head
Xander Sigler 12 months ago
parent f334a7746a
commit cce05b2179

@ -25,7 +25,12 @@ namespace AdventOfCode.Controllers
{ {
_logger.LogInformation($"Recieving a request for {year} day {day} version {version} with {(IgnoreLogMessages ? "no" : "")}logs"); _logger.LogInformation($"Recieving a request for {year} day {day} version {version} with {(IgnoreLogMessages ? "no" : "")}logs");
AOCRequest request = new AOCRequest() { Input = input, Version = version, IgnoreLogMessages = IgnoreLogMessages }; AOCRequest request = new AOCRequest() { Input = input, Version = version, IgnoreLogMessages = IgnoreLogMessages };
var resp = GetAOCDay(year, day).ExecuteDay(request); var aocDay = GetAOCDay(year, day);
if (aocDay == null)
{
return new AOCResponse() { Status = false, StackTrace = $"Year {2023} Day {day} part {version} is not available at this time!" };
}
var resp = aocDay.ExecuteDay(request);
return resp; return resp;
} }

@ -39,7 +39,7 @@ namespace AdventOfCode
services.AddControllers(); services.AddControllers();
services.AddSwaggerGen(c => services.AddSwaggerGen(c =>
{ {
c.SwaggerDoc("v1", new OpenApiInfo { Title = "AdventofCode", Version = "v1.0.0" }); c.SwaggerDoc("v1", new OpenApiInfo { Title = "AdventofCode", Version = "v1.0.1" });
}); });
services.AddControllers(o => o.InputFormatters.Insert(o.InputFormatters.Count, new TextPlainInputFormatter())); services.AddControllers(o => o.InputFormatters.Insert(o.InputFormatters.Count, new TextPlainInputFormatter()));
services.AddSwaggerGenNewtonsoftSupport(); services.AddSwaggerGenNewtonsoftSupport();

Loading…
Cancel
Save