-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error handling for download endpoint #173
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #173 +/- ##
=======================================
Coverage 66.52% 66.52%
=======================================
Files 437 437
Lines 34233 34233
Branches 4583 4583
=======================================
Hits 22775 22775
Misses 10368 10368
Partials 1090 1090 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @johnml1135)
src/SIL.Machine.AspNetCore/Services/InvalidOperationInterceptor.cs
line 3 at r1 (raw file):
namespace SIL.Machine.AspNetCore.Services; public class InvalidOperationInterceptor : Interceptor
Is there a particular exception that we aren't handling that prompted the addition of this interceptor?
src/SIL.Machine.AspNetCore/Services/NmtEngineService.cs
line 140 at r1 (raw file):
if (!fileExists) { throw new RpcException(
You shouldn't throw an RpcException
from the service layer, since it couples the services to the gRPC implementation of the API layer. You can catch the FileNotFoundException
in the API layer and rethrow an RpcException
. Also, the error message doesn't totally make sense to me. Maybe something like "The model for build revision , {engine.BuildRevision}, does not exist."
Previously, ddaspit (Damien Daspit) wrote…
Put back to FileNotFound |
Previously, ddaspit (Damien Daspit) wrote…
I put moved the FileNotFound catch to the API layer (I believe). I just looked up 3 layer architecture - I think it makes sense now. |
302abe1
to
8b2765f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @johnml1135)
src/SIL.Machine.AspNetCore/Services/ServalTranslationEngineServiceV1.cs
line 155 at r2 (raw file):
catch (FileNotFoundException e) { throw new RpcException(new Status(StatusCode.DataLoss, e.Message));
I think NotFound
would be a more appropriate status code.
In e2e test, grab current machine.py version
8b2765f
to
8d6ae6d
Compare
Previously, ddaspit (Damien Daspit) wrote…
Sure - data loss has "not recoverable" - the person can rebuild the engine if need be, as could be the case if we allow for patching engines to allow for "IsModelPersisted" to be updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @johnml1135)
In e2e test, grab current machine.py version
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)