[fix] Allow creation of errors with code but no message

Currently when creating an error with code but with a `null` message, the function fails. This fix enables that use case.