You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If `apiKey` is None, then we'll connect to a [mock server](https://www.listennotes.com/api/tutorials/#faq0) that returns fake data for testing purposes.
45
84
46
-
# Run all unit tests
47
-
./gradlew test
85
+
You can quickly run sample code using gradle:
86
+
```shell
87
+
# Use api mock server for test data
88
+
./gradlew run
48
89
49
-
#Run a specific test case
50
-
./gradlew test --tests ClientTest.testSearch
90
+
#Use production server for real data
91
+
LISTEN_API_KEY=your-api-key-here ./gradlew run
51
92
```
93
+
94
+
95
+
### Handling exceptions
96
+
97
+
Unsuccessful requests raise exceptions. The class of the exception will reflect
98
+
the sort of error that occurred.
99
+
100
+
| Exception Class | Description |
101
+
| ------------- | ------------- |
102
+
| AuthenticationException | wrong api key or your account is suspended |
103
+
| ApiConnectionException | fail to connect to API servers |
104
+
| InvalidRequestException | something wrong on your end (client side errors), e.g., missing required parameters |
105
+
| RateLimitException | you are using FREE plan and you exceed the quota limit |
106
+
| NotFoundException | endpoint not exist, or podcast / episode not exist |
107
+
| ListenApiException | something wrong on our end (unexpected server errors) |
108
+
109
+
All exception classes can be found in [this folder](https://github.com/ListenNotes/podcast-api-java/tree/main/src/main/java/com/listennotes/podcast_api/exception).
110
+
111
+
And you can see some sample code [here](https://github.com/ListenNotes/podcast-api-java/blob/main/src/main/java/com/listennotes/podcast_api/Sample.java).
0 commit comments