Skip to content

Commit c20de78

Browse files
Fix pack/unpack specs when using ext (#87)
* Fix pack/unpack specs when using ext * msgpack_packer was nto the case.
1 parent f1e1b98 commit c20de78

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/msgpack.erl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,14 @@ unpack(Bin, Opts) ->
120120

121121
-spec unpack_stream(binary()) -> {msgpack:object(), binary()}
122122
| {error, incomplete}
123-
| {error, {badarg, term()}}.
123+
| {error, {badarg, term()}}
124+
| {error, any()}.
124125
unpack_stream(Bin) -> unpack_stream(Bin, []).
125126

126127
-spec unpack_stream(binary(), msgpack:options())-> {msgpack:object(), binary()}
127128
| {error, incomplete}
128-
| {error, {badarg, term()}}.
129+
| {error, {badarg, term()}}
130+
| {error, any()}.
129131
unpack_stream(Bin, Opts0) when is_binary(Bin) ->
130132
Opts = parse_options(Opts0),
131133
try

src/msgpack_packer.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ pack_map(M, Opt)->
345345
throw({badarg, M})
346346
end.
347347

348-
-spec pack_ext(any(), msgpack:ext_packer(), msgpack:options()) -> {ok, binary()} | {error, any()}.
348+
-spec pack_ext(any(), msgpack:ext_packer(), msgpack:options()) -> {ok, binary()}.
349349
pack_ext(Any, Packer, Opt) ->
350350
case Packer(Any, Opt) of
351351
{ok, {Type, Data}} when -16#80 =< Type andalso Type =< 16#7F ->

src/msgpack_unpacker.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
-export([unpack_map/3, unpack_map_jiffy/3, unpack_map_jsx/3]).
2828

2929
%% unpack them all
30-
-spec unpack_stream(Bin::binary(), ?OPTION{}) -> {msgpack:object(), binary()} | no_return().
30+
-spec unpack_stream(Bin::binary(), ?OPTION{}) -> {msgpack:object(), binary()} | {error, any()} | no_return().
3131
%% ATOMS
3232
unpack_stream(<<16#C0, Rest/binary>>, _) ->
3333
{null, Rest};

0 commit comments

Comments
 (0)