Skip to content

Commit cc8bb75

Browse files
committed
fix no function clause matching
bump to version 0.8.3
1 parent 97106ba commit cc8bb75

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
#120
8+
## 0.8.3 (2022-02-17)
9+
* Bugfix
10+
* fix no function clause matching (thanks for bodbdigr)
911

1012
## 0.8.2 (2022-02-03)
1113
* Enhancements
1214
* Remove a compiler warning (thanks for a-jimenez )
1315

14-
[## 0.8.1 (2022-01-22)
16+
## 0.8.1 (2022-01-22)
1517
* Enhancements
1618
* Fix for serializing BSON Regex without options (thanks to MillionIntegrals)
1719
* Misc doc changes (thanks to kianmeng)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ Add `mongodb_driver` to your mix.exs `deps`.
218218

219219
```elixir
220220
defp deps do
221-
[{:mongodb_driver, "~> 0.8.1"}]
221+
[{:mongodb_driver, "~> 0.8.3"}]
222222
end
223223
```
224224

lib/mongo/error.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@ defmodule Mongo.Error do
195195
Keyword.get(opts, :session, nil) == nil && Keyword.get(opts, :retry_counter, nil) == nil && result
196196
end
197197

198+
# catch all function
199+
def not_writable_primary_or_recovering?(_other, opts) do
200+
false
201+
end
202+
198203
@doc """
199204
Returns true if the error is issued by the failCommand
200205
"""

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Mongodb.Mixfile do
22
use Mix.Project
33

44
@source_url "https://github.com/zookzook/elixir-mongodb-driver"
5-
@version "0.8.2"
5+
@version "0.8.3"
66

77
def project() do
88
[

test/mongo/errors_test.exs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
defmodule Mongo.ErrorsTest do
22
use ExUnit.Case, async: false
33

4+
alias Mongo.Error
5+
46
@host_unreachable 6
57
@host_not_found 7
68
@network_timeout 89
@@ -52,7 +54,15 @@ defmodule Mongo.ErrorsTest do
5254

5355
assert {:ok, _} = Mongo.admin_command(top, fail_cmd)
5456
assert {:error, msg} = Mongo.find_one(top, "test", %{})
57+
5558
assert msg.resumable == true
5659

5760
end
61+
62+
test "handle connection error" do
63+
the_error = %DBConnection.ConnectionError{}
64+
assert false == Error.not_writable_primary_or_recovering?(the_error, [])
65+
assert false == Error.should_retry_read(the_error, [ping: 1], [])
66+
end
67+
5868
end

0 commit comments

Comments
 (0)