Skip to content

Commit 2daaf71

Browse files
committed
Allow response to be 204 if there is an upstream failure
1 parent 2fca300 commit 2daaf71

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

helm/values.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,4 @@ envVars:
115115
COMPlus_EnableDiagnostics: "0"
116116
ASPNETCORE_ENVIRONMENT: Production
117117
ASPNETCORE_URLS: http://+:8080;http://+:58080
118+
ShowExceptions: false

src/Program.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,19 @@
6363

6464
return Results.Ok(jsonObject);
6565
}
66-
catch (HttpRequestException e)
66+
catch (Exception e)
6767
{
6868
Console.WriteLine("\nException Caught!");
6969
Console.WriteLine("Message: {0} ", e.Message);
70-
return Results.BadRequest(e.Message);
70+
71+
if (builder.Configuration.GetValue<bool>("ShowExceptions"))
72+
{
73+
throw new InvalidOperationException(e.Message);
74+
}
75+
else
76+
{
77+
return Results.NoContent();
78+
}
7179
}
7280
}).CacheOutput();
7381

0 commit comments

Comments
 (0)