Skip to content

Commit 7a710f3

Browse files
committed
Emit helpful error on unsupported Erlang versions
Closes #714
1 parent eb529f6 commit 7a710f3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/gleam_stdlib.erl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,13 @@ string_pop_grapheme(String) ->
206206
bit_array_concat(BitArrays) ->
207207
list_to_bitstring(BitArrays).
208208

209+
-if(?OTP_RELEASE >= 26).
209210
bit_array_base64_encode(Bin, Padding) ->
210211
base64:encode(Bin, #{padding => Padding}).
212+
-else.
213+
bit_array_base64_encode(_Bin, _Padding) ->
214+
erlang:error(<<"Erlang OTP/26 or higher is required to use base64:encode">>).
215+
-endif.
211216

212217
bit_array_slice(Bin, Pos, Len) ->
213218
try {ok, binary:part(Bin, Pos, Len)}

0 commit comments

Comments
 (0)