Skip to content
This repository was archived by the owner on Oct 4, 2024. It is now read-only.

Commit 534001c

Browse files
committed
Aggiunto esempio StatusCode 504 - GatewayTimeout
1 parent b04f5b9 commit 534001c

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/CustomLibrary.ProblemDetails.Sample/Controllers/TestController.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public async Task<IActionResult> GetExceptionInternalServerErrorAsync()
163163
}
164164
}
165165

166-
[HttpGet("NotImplemented")]
166+
[HttpGet("NotImplemented-Exception")]
167167
public async Task<IActionResult> GetExceptionNotImplementedAsync()
168168
{
169169
try
@@ -177,7 +177,7 @@ public async Task<IActionResult> GetExceptionNotImplementedAsync()
177177
}
178178
}
179179

180-
[HttpGet("BadGateway")]
180+
[HttpGet("BadGateway-Exception")]
181181
public async Task<IActionResult> GetExceptionBadGatewayAsync()
182182
{
183183
try
@@ -191,7 +191,7 @@ public async Task<IActionResult> GetExceptionBadGatewayAsync()
191191
}
192192
}
193193

194-
[HttpGet("ServiceUnavailable")]
194+
[HttpGet("ServiceUnavailable-Exception")]
195195
public async Task<IActionResult> GetExceptionServiceUnavailableAsync()
196196
{
197197
try
@@ -204,4 +204,18 @@ public async Task<IActionResult> GetExceptionServiceUnavailableAsync()
204204
return ResponseException.ServiceUnavailable(HttpContext, exc);
205205
}
206206
}
207+
208+
[HttpGet("GatewayTimeout-Exception")]
209+
public async Task<IActionResult> GetExceptionGatewayTimeoutAsync()
210+
{
211+
try
212+
{
213+
await Task.Delay(500);
214+
throw new Exception.GatewayTimeoutException("Gateway Timeout");
215+
}
216+
catch (Exception.GatewayTimeoutException exc)
217+
{
218+
return ResponseException.GatewayTimeout(HttpContext, exc);
219+
}
220+
}
207221
}

0 commit comments

Comments
 (0)