Will-Lo commented on code in PR #3516:
URL: https://github.com/apache/gobblin/pull/3516#discussion_r909706635
##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/api/MutableSpecCatalog.java:
##########
@@ -48,7 +48,7 @@ public interface MutableSpecCatalog extends SpecCatalog {
* on adding a {@link Spec} to the {@link SpecCatalog}. The key for each
entry is the name of the {@link SpecCatalogListener}
* and the value is the result of the the action taken by the listener
returned as an instance of {@link AddSpecResponse}.
* */
- Map<String, AddSpecResponse> put(Spec spec);
+ Map<String, AddSpecResponse> put(Spec spec) throws Throwable;
Review Comment:
It's a bit convoluted here the `QuotaExceededException` gets thrown in a
callback and is caught by `CallbackResult`, which stores any exception thrown
as a `Throwable`. I wanted to leverage that by accessing it through
`getCause()`. Classes that rely on the `CallBackResult` responses would have to
throw the generic `Throwable` class unless I casted the exception back into the
`QuotaExceededException`, but I want to avoid doing that for future support of
throwing compilation errors in this fashion as well.
In particular in this segment:
```
if (response.getValue().getFailures().size() > 0) {
for (Map.Entry<SpecCatalogListener, CallbackResult<AddSpecResponse>>
entry : response.getValue().getFailures().entrySet()) {
throw entry.getValue().getError().getCause();
}
return responseMap;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]