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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
# Changelog
2
2
3
+
## 0.3.2
4
+
5
+
* Changed: Example now showcases exception handling.
6
+
* Changed: README now showcases exception handling.
7
+
* Fixed: Interceptor no longer using custom exceptions, instead it rethrows in the case that the retry policy is not set or if it has reached max attempts.
8
+
3
9
## 0.3.1
4
10
5
11
* Fixed: Retry Policy's `shouldAttemptRetryOnResponse` was synchronous which would not allow async token updates.
throw Exception("Error while fetching. \n ${response.body}");
131
+
return Future.error(
132
+
"Error while fetching.",
133
+
StackTrace.fromString("${response.body}"),
134
+
);
134
135
}
135
-
} catch (e) {
136
-
print(e);
136
+
} on SocketException {
137
+
return Future.error('No Internet connection 😑');
138
+
} on FormatException {
139
+
return Future.error('Bad response format 👎');
140
+
} on Exception {
141
+
return Future.error('Unexpected error 😢');
137
142
}
143
+
138
144
return parsedWeather;
139
145
}
140
146
@@ -143,7 +149,7 @@ class WeatherRepository {
143
149
144
150
### Retrying requests
145
151
146
-
**(NEW 🎉)** Sometimes you need to retry a request due to different circumstances, an expired token is a really good example. Here's how you could potentially implement an expired token retry policy with `http_interceptor`.
152
+
**(NEW 🎉)** Sometimes you need to retry a request due to different circumstances, an expired token is a really good example. Here's how you could potentially implement an expired token retry policy with `http_interceptor`.
147
153
148
154
```dart
149
155
class ExpiredTokenRetryPolicy extends RetryPolicy {
@@ -164,7 +170,7 @@ You can also set the maximum amount of retry attempts with `maxRetryAttempts` pr
164
170
165
171
### Using self signed certificates
166
172
167
-
**(EXPERIMENTAL ⚗️)** This plugin allows you to override the default `badCertificateCallback` provided by Dart's `io` package, this is really useful when working with self-signed certificates in your server. This can be done by sending a the callback to the HttpInterceptor builder functions. This feature is marked as experimental and **might be subject to change before release 1.0.0 comes**.
173
+
**(EXPERIMENTAL ⚗️)** This plugin allows you to override the default `badCertificateCallback` provided by Dart's `io` package, this is really useful when working with self-signed certificates in your server. This can be done by sending a the callback to the HttpInterceptor builder functions. This feature is marked as experimental and **might be subject to change before release 1.0.0 comes**.
0 commit comments