Skip to content

Script exits without visible error message on curl network error

Version: 1.3.1

The script has set -e at the top.
This causes the curl commands called later to exit immediately on any network error.

Steps to reproduce:

  • Call the script using any non-existing host name (eg. invalid.):

    ./psu auth --url https://invalid. --user admin --password pw

Current behavior:

  • Process exits without any visible error message.
  • Exit code is non-zero indicating some error, but without more context, this is not helpful enough.

Expected behavior:

Error message containing the following information:

  • an error occurred while running curl
  • curl exit code
  • descriptive error message if possible

For the example above it could be something like:

curl error! Exit code: 6
curl error: Could not resolve host. The given remote host could not be resolved.