-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More logging and better error handling for download endpoint
- Loading branch information
1 parent
525950f
commit 6690e54
Showing
4 changed files
with
65 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/SIL.Machine.AspNetCore/Services/InvalidOperationInterceptor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace SIL.Machine.AspNetCore.Services; | ||
|
||
public class InvalidOperationInterceptor : Interceptor | ||
{ | ||
public override async Task<TResponse> UnaryServerHandler<TRequest, TResponse>( | ||
TRequest request, | ||
ServerCallContext context, | ||
UnaryServerMethod<TRequest, TResponse> continuation | ||
) | ||
{ | ||
try | ||
{ | ||
return await continuation(request, context); | ||
} | ||
catch (InvalidOperationException) | ||
{ | ||
throw new RpcException(new Status(StatusCode.InvalidArgument, "This operation is not valid at this time.")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters