Skip to content

this class needs more work -  #3

Open

Description

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

Activity

  1. sharmaudit124 commented on Aug 16, 2023

    @sharmaudit124

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions