opentdf / java-sdk

OpenTDF Java SDK
BSD 3-Clause Clear License
0 stars 1 forks source link

Provide clear createTDF error when using unknown attributes #175

Open ttschampel opened 6 days ago

ttschampel commented 6 days ago

Repro:

call the createTDF method with attribute values that do not exist.

Result:

Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: NOT_FOUND: resource not found
    at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:592)
    at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:571)
    at io.opentdf.platform.sdk.Autoconfigure.newGranterFromService(Autoconfigure.java:690)
    at io.opentdf.platform.sdk.TDF.createTDF(TDF.java:387)

It is unclear that this error occurs b/c the attribute does not exist in the target platform.

Recommendation: update to provide a more meaningful error. The current error appears to point to a connectivity or platform proto mismatch vs the actual error..resulting in a lot of wasted time debugging

mkleene commented 5 days ago

@ttschampel I agree that this is misleading but I think that error messages like this should originate with the platform.

There are lots of things that could be missing and unless the platform tells clients what it is I think that having clients work out what it is will be too tough and subject to change.

In cases like this we might want to just start logging what's going on in the platform so we can look there.

ttschampel commented 5 days ago

I agree platform should provide useful messages. A NOT FOUND error from the platform might be ok here if the SDK provided extract context in the error message - the SDK knows its trying to look up something and it's not found, so could report that.

Otherwise, like you said platform needs to provide more context in the error

I don't think looking at platform logs is going to be an option for app developers