We’re migrating one of our projects to Elixir 1.18.4 (from 1.16.2). Facing a lot of issues because of --warnings-as-errors
, but most of them are easily fixable. And, it actually found a couple of bugs in our code base, like it!
However, there’s one warning I don’t know how to fix yet. It’s a simple line:
File.write!(printed_pdf, Fast64.decode64(pdf_data))
That yields the following warning:
Compiling 28 files (.ex)
warning: incompatible types given to File.write!/2:
File.write!(printed_pdf, Fast64.decode64(pdf_data))
given types:
dynamic(), none()
the 2nd argument is empty (often represented as none()), most likely because it is the result of an expression that always fails, such as a `raise` or a previous invalid call. This causes any function called with this value to fail
That’s because it’s NIF and the default encode64
implementation is raising.
How do you all cope with situations like this?