aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2017-08-10 14:25:34 +0200
committerJohn Högberg <[email protected]>2017-09-05 15:56:16 +0200
commit8e8a7f16acb479fc2737ff73e5e0b5569a7ab71f (patch)
tree080f50e154908acf0049c4245d408b3b56e2916c /erts/preloaded/src
parent948ee9b34f34a55cb4b70b7077a849c7dc7a5f18 (diff)
downloadotp-8e8a7f16acb479fc2737ff73e5e0b5569a7ab71f.tar.gz
otp-8e8a7f16acb479fc2737ff73e5e0b5569a7ab71f.tar.bz2
otp-8e8a7f16acb479fc2737ff73e5e0b5569a7ab71f.zip
Improve zlib error messages and update test suite to fit
OTP-14527
Diffstat (limited to 'erts/preloaded/src')
-rw-r--r--erts/preloaded/src/zlib.erl14
1 files changed, 8 insertions, 6 deletions
diff --git a/erts/preloaded/src/zlib.erl b/erts/preloaded/src/zlib.erl
index 2731dddcb5..dca5a42779 100644
--- a/erts/preloaded/src/zlib.erl
+++ b/erts/preloaded/src/zlib.erl
@@ -634,34 +634,34 @@ arg_flush(none) -> ?Z_NO_FLUSH;
arg_flush(sync) -> ?Z_SYNC_FLUSH;
arg_flush(full) -> ?Z_FULL_FLUSH;
arg_flush(finish) -> ?Z_FINISH;
-arg_flush(_) -> erlang:error(badarg).
+arg_flush(_) -> erlang:error(bad_flush_mode).
arg_level(none) -> ?Z_NO_COMPRESSION;
arg_level(best_speed) -> ?Z_BEST_SPEED;
arg_level(best_compression) -> ?Z_BEST_COMPRESSION;
arg_level(default) -> ?Z_DEFAULT_COMPRESSION;
arg_level(Level) when is_integer(Level), Level >= 0, Level =< 9 -> Level;
-arg_level(_) -> erlang:error(badarg).
+arg_level(_) -> erlang:error(bad_compression_level).
arg_strategy(filtered) -> ?Z_FILTERED;
arg_strategy(huffman_only) -> ?Z_HUFFMAN_ONLY;
arg_strategy(rle) -> ?Z_RLE;
arg_strategy(default) -> ?Z_DEFAULT_STRATEGY;
-arg_strategy(_) -> erlang:error(badarg).
+arg_strategy(_) -> erlang:error(bad_compression_strategy).
arg_method(deflated) -> ?Z_DEFLATED;
-arg_method(_) -> erlang:error(badarg).
+arg_method(_) -> erlang:error(bad_compression_method).
-spec arg_bitsz(zwindowbits()) -> zwindowbits().
arg_bitsz(Bits) when is_integer(Bits) andalso
((8 =< Bits andalso Bits < 48) orelse
(-15 =< Bits andalso Bits =< -8)) ->
Bits;
-arg_bitsz(_) -> erlang:error(badarg).
+arg_bitsz(_) -> erlang:error(bad_windowbits).
-spec arg_mem(zmemlevel()) -> zmemlevel().
arg_mem(Level) when is_integer(Level), 1 =< Level, Level =< 9 -> Level;
-arg_mem(_) -> erlang:error(badarg).
+arg_mem(_) -> erlang:error(bad_memlevel).
-spec enqueue_input(Z, IOData) -> ok when
Z :: zstream(),
@@ -669,6 +669,8 @@ arg_mem(_) -> erlang:error(badarg).
enqueue_input(Z, IOData) ->
enqueue_input_1(Z, erlang:iolist_to_iovec(IOData)).
+enqueue_input_1(_Z, []) ->
+ ok;
enqueue_input_1(Z, IOVec) ->
case enqueue_nif(Z, IOVec) of
{continue, Remainder} -> enqueue_input_1(Z, Remainder);