-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
(base) ➜ wweevv-java-with-commit git:(supabase) ✗ curl http://0.0.0.0:9999/user \
-H "Accept: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2NjA4MTU3MDcsInN1YiI6IjU0YTJiYTExLWFhNWYtNGMwYy1hMThmLTIwNWVjMGY5ODE5ZiIsImVtYWlsIjoiZW1haWwyQGV4YW1wbGUuY29tIiwicGhvbmUiOiIiLCJhcHBfbWV0YWRhdGEiOnsicHJvdmlkZXIiOiJlbWFpbCIsInByb3ZpZGVycyI6WyJlbWFpbCJdfSwidXNlcl9tZXRhZGF0YSI6e30sInJvbGUiOiIifQ.Ys5pobjDxwfR9Md_S-aQ-SczC2wtBgZIykp0BsAYucw"
{"code":401,"msg":"Invalid token: token is expired by 1h7m17s"}% /// THIS IS USEFUL
calling endpoint with expired token - throws opaque error - api exception - but we should bubble up the actual error -
RestUtils.java
/**
* Sends a Get request.
*
* @param responseClass the class of the response.
* @param headers the headers that will be sent with the request.
* @param url the url the request will be sent to.
* @param <R> the type of the response.
* @return the response of the request parsed from json to R.
* @throws ApiException if a Exception is thrown.
*/
try {
HttpEntity<String> entity = toEntity(headers);
ResponseEntity<R> res = rest.exchange(url, HttpMethod.GET, entity, responseClass);
return res.getBody();
} catch (RestClientResponseException | ResourceAccessException e) {
throw new ApiException("Get failed", e); // tHIS IS BAD
}
Metadata
Metadata
Assignees
Labels
No labels