Raise exception on warnings if error_on_warning = True