Skip to content

Commit 5ad2571

Browse files
committed
api: remove Future.Err()
The method causes an improper error handling because it returns an error only from a client side. Therefore, it is not enough to simply check the error to find out that the request was not completed. A user should check an error from `Future.Get()` or `Future.GetTyped()`. In addition, the user can find out whether there was an error without decoding the response body with `Future.GetResponse()`, see `ExampleErrorNo`.
1 parent f33032e commit 5ad2571

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.
127127
- `Schema` field from the `Connection` struct (#7)
128128
- `OkCode` and `PushCode` constants (#237)
129129
- SSL support (#301)
130+
- `Future.Err()` method (#382)
130131

131132
### Fixed
132133

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@ for an `ops` field. `*Operations` needs to be used instead.
348348
* `Future` constructors now accept `Request` as their argument.
349349
* Methods `AppendPush` and `SetResponse` accepts response `Header` and data
350350
as their arguments.
351+
* Method `Err` removed because it provokes an invalid error checking. You need
352+
to check an error from `Get`, `GetTyped` or `GetResponse` with an addition
353+
check a value of `Response.Header().Error`.
351354

352355
#### Connector changes
353356

future.go

-8
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,3 @@ func (fut *Future) WaitChan() <-chan struct{} {
266266
}
267267
return fut.done
268268
}
269-
270-
// Err returns error set on Future.
271-
// It waits for future to be set.
272-
// Note: it doesn't decode body, therefore decoding error are not set here.
273-
func (fut *Future) Err() error {
274-
fut.wait()
275-
return fut.err
276-
}

0 commit comments

Comments
 (0)