make curl fail loudly for non-2xx downloads

`curl` fails silently if the status code of the response is not 2xx. This CL makes it fail loudly, and break the pipe.

Closes #11800.

PiperOrigin-RevId: 322353682
diff --git a/scripts/packages/bazel.sh b/scripts/packages/bazel.sh
index 1b353b9..03b7417 100755
--- a/scripts/packages/bazel.sh
+++ b/scripts/packages/bazel.sh
@@ -203,7 +203,7 @@
     if [[ -x $(command -v curl) && -w $wrapper_dir ]]; then
       (echo ""
       echo "You can download the required version directly using this command:"
-      echo "  (cd \"${wrapper_dir}\" && curl -LO https://releases.bazel.build/${bazel_version}/release/${long_binary_name} && chmod +x ${long_binary_name})") 2>&1
+      echo "  (cd \"${wrapper_dir}\" && curl -fLO https://releases.bazel.build/${bazel_version}/release/${long_binary_name} && chmod +x ${long_binary_name})") 2>&1
     elif [[ -x $(command -v wget) && -w $wrapper_dir ]]; then
       (echo ""
       echo "You can download the required version directly using this command:"