1 package com.guinetik.rr.auth;
2
3 import com.guinetik.rr.http.HttpConstants;
4 import com.guinetik.rr.http.RocketRestException;
5
6 /**
7 * Exception thrown when an API request fails due to token expiration.
8 *
9 * <p>This exception is thrown when a request receives a 401 Unauthorized response,
10 * indicating that the authentication token has expired or is invalid. The retry
11 * mechanism in {@link com.guinetik.rr.api.AbstractApiClient} catches this exception
12 * and attempts to refresh the token before retrying.
13 *
14 * <h2>Exception Hierarchy</h2>
15 * <pre>
16 * RuntimeException
17 * └── RocketRestException
18 * └── TokenExpiredException
19 * </pre>
20 *
21 * @author guinetik <guinetik@gmail.com>
22 * @see RocketRestException
23 * @see com.guinetik.rr.auth.AuthStrategy
24 * @since 1.0.0
25 */
26 public class TokenExpiredException extends RocketRestException {
27
28 private static final long serialVersionUID = 1L;
29
30 /**
31 * Creates a new TokenExpiredException with the specified message.
32 *
33 * @param message The exception message
34 */
35 public TokenExpiredException(String message) {
36 super(message, HttpConstants.StatusCodes.UNAUTHORIZED, null);
37 }
38
39 /**
40 * Creates a new TokenExpiredException with the specified message and cause.
41 *
42 * @param message The exception message
43 * @param cause The underlying cause
44 */
45 public TokenExpiredException(String message, Throwable cause) {
46 super(message, cause);
47 }
48 }