xref: /curl/docs/cmdline-opts/fail-early.md (revision 2abfc759)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Long: fail-early
5Help: Fail on first transfer error
6Added: 7.52.0
7Category: curl global
8Multi: boolean
9Scope: global
10See-also:
11  - fail
12  - fail-with-body
13Example:
14  - --fail-early $URL https://two.example
15---
16
17# `--fail-early`
18
19Fail and exit on the first detected transfer error.
20
21When curl is used to do multiple transfers on the command line, it attempts to
22operate on each given URL, one by one. By default, it ignores errors if there
23are more URLs given and the last URL's success determines the error code curl
24returns. Early failures are "hidden" by subsequent successful transfers.
25
26Using this option, curl instead returns an error on the first transfer that
27fails, independent of the amount of URLs that are given on the command
28line. This way, no transfer failures go undetected by scripts and similar.
29
30This option does not imply --fail, which causes transfers to fail due to the
31server's HTTP status code. You can combine the two options, however note --fail
32is not global and is therefore contained by --next.
33