Skip to content
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

this class needs more work - #3

Open
johndpope opened this issue Aug 18, 2022 · 1 comment
Open

this class needs more work - #3

johndpope opened this issue Aug 18, 2022 · 1 comment

Comments

@johndpope
Copy link
Contributor

johndpope commented Aug 18, 2022

(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
        }

@sharmaudit124
Copy link

Hey! I can make required changes in this class. Please allow me make changes or assign this issue to me.

sharmaudit124 added a commit to sharmaudit124/gotrue-java that referenced this issue Sep 1, 2023
Updated the code of the class given in issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants