Skip to content

Commit a88b9d4

Browse files
algolia-botmillotp
andcommitted
fix(clients): implement Is on custom errors (generated)
algolia/api-clients-automation#4588 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent 591576b commit a88b9d4

File tree

13 files changed

+90
-0
lines changed

13 files changed

+90
-0
lines changed

algolia/abtesting/client.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algolia/analytics/client.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algolia/composition/client.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algolia/errs/net_err.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,9 @@ func NetError(err net.Error, msg string) net.Error {
2121
func (e *netError) Error() string { return e.msg }
2222
func (e *netError) Timeout() bool { return e.isTimeout }
2323
func (e *netError) Temporary() bool { return e.isTemporary }
24+
25+
func (e netError) Is(target error) bool {
26+
_, ok := target.(*netError)
27+
28+
return ok
29+
}

algolia/errs/no_more_host_to_try_err.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,9 @@ func (e *NoMoreHostToTryError) Error() string {
2727
}
2828
return "all hosts have been contacted unsuccessfully, it can either be a server or a network error or wrong appID/key credentials were used. You can use 'ExposeIntermediateNetworkErrors: true' in the config to investigate."
2929
}
30+
31+
func (n NoMoreHostToTryError) Is(target error) bool {
32+
_, ok := target.(*NoMoreHostToTryError)
33+
34+
return ok
35+
}

algolia/errs/wait_err.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,32 @@ func (e WaitError) Error() string {
1414
return e.msg
1515
}
1616

17+
func (e WaitError) Is(target error) bool {
18+
_, ok := target.(*WaitError)
19+
20+
return ok
21+
}
22+
1723
type WaitKeyUpdateError struct{}
1824

1925
func (e WaitKeyUpdateError) Error() string {
2026
return "`apiKey` is required when waiting for an `update` operation."
2127
}
2228

29+
func (e WaitKeyUpdateError) Is(target error) bool {
30+
_, ok := target.(*WaitKeyUpdateError)
31+
32+
return ok
33+
}
34+
2335
type WaitKeyOperationError struct{}
2436

2537
func (e WaitKeyOperationError) Error() string {
2638
return "`operation` must be one of `add`, `update` or `delete`."
2739
}
40+
41+
func (e WaitKeyOperationError) Is(target error) bool {
42+
_, ok := target.(*WaitKeyOperationError)
43+
44+
return ok
45+
}

algolia/ingestion/client.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algolia/insights/client.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algolia/monitoring/client.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

algolia/personalization/client.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)