xref: /aosp_15_r20/external/curl/docs/cmdline-opts/fail-early.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerLong: fail-early
5*6236dae4SAndroid Build Coastguard WorkerHelp: Fail on first transfer error
6*6236dae4SAndroid Build Coastguard WorkerAdded: 7.52.0
7*6236dae4SAndroid Build Coastguard WorkerCategory: curl global
8*6236dae4SAndroid Build Coastguard WorkerMulti: boolean
9*6236dae4SAndroid Build Coastguard WorkerScope: global
10*6236dae4SAndroid Build Coastguard WorkerSee-also:
11*6236dae4SAndroid Build Coastguard Worker  - fail
12*6236dae4SAndroid Build Coastguard Worker  - fail-with-body
13*6236dae4SAndroid Build Coastguard WorkerExample:
14*6236dae4SAndroid Build Coastguard Worker  - --fail-early $URL https://two.example
15*6236dae4SAndroid Build Coastguard Worker---
16*6236dae4SAndroid Build Coastguard Worker
17*6236dae4SAndroid Build Coastguard Worker# `--fail-early`
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard WorkerFail and exit on the first detected transfer error.
20*6236dae4SAndroid Build Coastguard Worker
21*6236dae4SAndroid Build Coastguard WorkerWhen curl is used to do multiple transfers on the command line, it attempts to
22*6236dae4SAndroid Build Coastguard Workeroperate on each given URL, one by one. By default, it ignores errors if there
23*6236dae4SAndroid Build Coastguard Workerare more URLs given and the last URL's success determines the error code curl
24*6236dae4SAndroid Build Coastguard Workerreturns. Early failures are "hidden" by subsequent successful transfers.
25*6236dae4SAndroid Build Coastguard Worker
26*6236dae4SAndroid Build Coastguard WorkerUsing this option, curl instead returns an error on the first transfer that
27*6236dae4SAndroid Build Coastguard Workerfails, independent of the amount of URLs that are given on the command
28*6236dae4SAndroid Build Coastguard Workerline. This way, no transfer failures go undetected by scripts and similar.
29*6236dae4SAndroid Build Coastguard Worker
30*6236dae4SAndroid Build Coastguard WorkerThis option does not imply --fail, which causes transfers to fail due to the
31*6236dae4SAndroid Build Coastguard Workerserver's HTTP status code. You can combine the two options, however note --fail
32*6236dae4SAndroid Build Coastguard Workeris not global and is therefore contained by --next.
33