-
Notifications
You must be signed in to change notification settings - Fork 155
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
Incorrect/unclear Error Message #5
Comments
Thanks, James. I'll pass this on to our service teams -- that message about compartmentId being wrong comes from the server. |
Hey James, When fetching a user, the SDK does: When you provide an empty string, it does: Which is the same path as doing a ListUsers call, so the server responds with an error saying compartmentId is missing because ListUsers requires it. There's unfortunately nothing the server can do here, it's responding to the REST call appropriately. On the SDK side we'll add better client-side validation for path elements ensure they're not just null, but also non-empty. For now you'll probably want to validate the userId is non-empty yourself before making the GetUser call. HTH, |
Whoops, didn't mean to close... keeping open to track. |
Thanks for tracking this down! I have handled the empty user string on my side as you suggested. |
The latest version of the SDK: d1b2ef5 There's now a client side check to make sure you don't provide empty path params. I'll improve the messaging in another version, but this should at least make it less confusing by not making the wrong request to the server. |
If passing an empty userID string to -
GetUserResponse user = identityService.getUser(GetUserRequest.builder().userId(event.getPrincipalId()).build());
The error message is
Exception in thread "main" com.oracle.bmc.model.BmcException: (400, InvalidParameter, false) Invalid parameter 'compartmentId' (opc-request-id: AC33DA26DDE6430ABC88BBF04DE73E3B/37632E5CB5C4465EA6C33DE3512F033A/6532C2AE95E44D74B7DD08166D755E0A)
at com.oracle.bmc.http.internal.ResponseHelper.throwIfNotSuccessful(ResponseHelper.java:91)
at com.oracle.bmc.http.internal.ResponseConversionFunctionFactory$ValidatingParseResponseFunction.apply(ResponseConversionFunctionFactory.java:87)
at com.oracle.bmc.http.internal.ResponseConversionFunctionFactory$ValidatingParseResponseFunction.apply(ResponseConversionFunctionFactory.java:83)
at com.oracle.bmc.identity.internal.http.GetUserConverter$1.apply(GetUserConverter.java:64)
at com.oracle.bmc.identity.internal.http.GetUserConverter$1.apply(GetUserConverter.java:57)
at com.oracle.bmc.identity.IdentityClient.getUser(IdentityClient.java:293)
at ListAuditEventsSinceDate.main(ListAuditEventsSinceDate.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
The text was updated successfully, but these errors were encountered: