Skip to content

Commit 2358d44

Browse files
authored
Merge pull request #23 from dec4234/22-throwing
22 throwing
2 parents 42f6466 + 0e8e017 commit 2358d44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+667
-427
lines changed

pom.xml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
~ Copyright (c) dec4234 2021. Access is granted, without any express warranties or guarentees of
4-
~ any kind, to all wishing to use this software for their benefit. No one may specifically claim credit, or
5-
~ ownership of this software without the explicit permission of the author.
3+
~ Copyright (c) 2024. dec4234
4+
~ A standard open MIT license applies. Modififcation and usage permitted with credit. No warranties or express guarentees are given in any way.
65
~
7-
~ GitHub -> https://github.com/dec4234/JavaDestinyAPI
6+
~ Github -> https://github.com/dec4234/JavaDestinyAPI
87
-->
98

109
<project xmlns="http://maven.apache.org/POM/4.0.0"
@@ -18,7 +17,7 @@
1817
<packaging>jar</packaging>
1918

2019
<name>JavaDestinyAPI</name>
21-
<description>A Java wrapper for bungie.net platform api, allowing users to get data about the video games Destiny and Destiny 2</description>
20+
<description>A Java wrapper for bungie.net platform API, allowing users to get data about the video games Destiny and Destiny 2</description>
2221
<url>https://github.com/dec4234/JavaDestinyAPI</url>
2322

2423
<licenses>
@@ -51,7 +50,7 @@
5150
<dependency>
5251
<groupId>com.google.code.gson</groupId>
5352
<artifactId>gson</artifactId>
54-
<version>2.8.6</version>
53+
<version>2.8.9</version>
5554
</dependency>
5655
<dependency>
5756
<groupId>org.jetbrains</groupId>
@@ -62,7 +61,7 @@
6261
<dependency>
6362
<groupId>org.apache.maven.plugins</groupId>
6463
<artifactId>maven-compiler-plugin</artifactId>
65-
<version>3.8.1</version>
64+
<version>3.11.0</version>
6665
</dependency>
6766
</dependencies>
6867

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2024. dec4234
3+
* A standard open MIT license applies. Modififcation and usage permitted with credit. No warranties or express guarentees are given in any way.
4+
*
5+
* Github -> https://github.com/dec4234/JavaDestinyAPI
6+
*/
7+
8+
package net.dec4234.javadestinyapi.exceptions;
9+
10+
/**
11+
* Base class for all exceptions generated when an issue occurs in the request pipeline to Bungie.
12+
* This most common reason for this error would be when the API is offline, and all objects are misparsed.
13+
*/
14+
public abstract class APIException extends Exception {
15+
16+
public APIException() {
17+
18+
}
19+
20+
public APIException(String errorMessage) {
21+
super(errorMessage);
22+
}
23+
24+
public APIException(Exception e) {
25+
super(e);
26+
}
27+
}

src/main/java/net/dec4234/javadestinyapi/exceptions/APIOfflineException.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
/*
2-
* Copyright (c) dec4234 2021. Access is granted, without any express warranties or guarantees of
3-
* any kind, to all wishing to use this software for their benefit. No one may specifically claim credit, or
4-
* ownership of this software without the explicit permission of the author.
2+
* Copyright (c) 2024. dec4234
3+
* A standard open MIT license applies. Modififcation and usage permitted with credit. No warranties or express guarentees are given in any way.
54
*
6-
* GitHub -> https://github.com/dec4234/JavaDestinyAPI
5+
* Github -> https://github.com/dec4234/JavaDestinyAPI
76
*/
87

98
package net.dec4234.javadestinyapi.exceptions;
109

1110
/**
1211
* Indicates that the request returned error code 5 (The API has been disabled by Bungie)
1312
*/
14-
public class APIOfflineException extends Exception {
13+
public class APIOfflineException extends APIException {
1514

1615
public APIOfflineException(String returnMessage) {
1716
super("The Bungie API returned this message: " + returnMessage);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (c) 2024. dec4234
3+
* A standard open MIT license applies. Modififcation and usage permitted with credit. No warranties or express guarentees are given in any way.
4+
*
5+
* Github -> https://github.com/dec4234/JavaDestinyAPI
6+
*/
7+
8+
package net.dec4234.javadestinyapi.exceptions;
9+
10+
/**
11+
* Self explanatory. The access token needs to be regenerated using the refresh token.
12+
*/
13+
public class AccessTokenExpiredException extends APIException{
14+
}

src/main/java/net/dec4234/javadestinyapi/exceptions/AccessTokenInvalidException.java

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2024. dec4234
3+
* A standard open MIT license applies. Modififcation and usage permitted with credit. No warranties or express guarentees are given in any way.
4+
*
5+
* Github -> https://github.com/dec4234/JavaDestinyAPI
6+
*/
7+
8+
package net.dec4234.javadestinyapi.exceptions;
9+
10+
public class ConnectionException extends APIException {
11+
12+
public ConnectionException(Exception exception) {
13+
super(exception);
14+
}
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2024. dec4234
3+
* A standard open MIT license applies. Modififcation and usage permitted with credit. No warranties or express guarentees are given in any way.
4+
*
5+
* Github -> https://github.com/dec4234/JavaDestinyAPI
6+
*/
7+
8+
package net.dec4234.javadestinyapi.exceptions;
9+
10+
/**
11+
* When a token is missing or wrong, or some other pre-condition was not met that was needed to execute a request.
12+
* This is a generic error, check the associated error message for more information.
13+
*/
14+
public class InvalidConditionException extends APIException {
15+
16+
public InvalidConditionException(String message) {
17+
super(message);
18+
}
19+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2024. dec4234
3+
* A standard open MIT license applies. Modififcation and usage permitted with credit. No warranties or express guarentees are given in any way.
4+
*
5+
* Github -> https://github.com/dec4234/JavaDestinyAPI
6+
*/
7+
8+
package net.dec4234.javadestinyapi.exceptions;
9+
10+
import com.google.gson.JsonSyntaxException;
11+
12+
/**
13+
* Malformed or non-json content found where JSON was expected. Usually at an API endpoint.
14+
*/
15+
public class JsonParsingError extends APIException {
16+
17+
public JsonParsingError(String message) {
18+
super(message);
19+
}
20+
21+
public JsonParsingError(JsonSyntaxException exception) {
22+
super(exception);
23+
}
24+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2024. dec4234
3+
* A standard open MIT license applies. Modififcation and usage permitted with credit. No warranties or express guarentees are given in any way.
4+
*
5+
* Github -> https://github.com/dec4234/JavaDestinyAPI
6+
*/
7+
8+
package net.dec4234.javadestinyapi.exceptions;
9+
10+
/**
11+
* You either have insufficient permission to attempt this OAuth action, or you forgot to authorize yourself.
12+
* Alternatively, the access and/or refresh token has expired
13+
* See {@link net.dec4234.javadestinyapi.utils.framework.OAuthFlow}
14+
*/
15+
public class OAuthUnauthorizedException extends APIException {
16+
17+
public OAuthUnauthorizedException(String message) {
18+
super(message);
19+
}
20+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2024. dec4234
3+
* A standard open MIT license applies. Modififcation and usage permitted with credit. No warranties or express guarentees are given in any way.
4+
*
5+
* Github -> https://github.com/dec4234/JavaDestinyAPI
6+
*/
7+
8+
package net.dec4234.javadestinyapi.exceptions;
9+
10+
/**
11+
* The name is self-expanatory. The refresh token normally used to generate a new access token has expired since it
12+
* hasn't been refreshed in the past 90 days or it has been 1 year since the last oauth.
13+
* See {@link net.dec4234.javadestinyapi.utils.framework.OAuthFlow} to generate a new one.
14+
*/
15+
public class RefreshTokenExpiredException extends APIException {
16+
17+
}

0 commit comments

Comments
 (0)