Skip to content

Commit 201fb74

Browse files
gianluca-nittiGianluca Nitti
andauthored
Fix some typespecs (#173)
Co-authored-by: Gianluca Nitti <[email protected]>
1 parent 706078e commit 201fb74

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/mongo.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ defmodule Mongo do
7070

7171
@type conn :: DbConnection.Conn
7272
@type collection :: String.t()
73-
@opaque cursor :: Mongo.Cursor.t()
74-
@type result(t) :: :ok | {:ok, t} | {:error, Mongo.Error.t()}
73+
@type cursor :: Mongo.Cursor.t()
74+
@type result(t) :: :ok | {:ok, t} | {:error, Mongo.Error.t()} | {:error, Mongo.WriteError.t()}
7575
@type result!(t) :: t
7676
@type initial_type :: :unknown | :single | :replica_set_no_primary | :sharded
7777

lib/mongo/error.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ end
217217
defmodule Mongo.WriteError do
218218
defexception [:n, :ok, :write_errors]
219219

220+
@type t :: %__MODULE__{
221+
n: number,
222+
ok: number,
223+
write_errors: [map]
224+
}
225+
220226
def message(e) do
221227
"n: #{e.n}, ok: #{e.ok}, write_errors: #{inspect(e.write_errors)}"
222228
end

0 commit comments

Comments
 (0)