Commit 973703e
committed
remote-curl: introduce show_http_message_fatal() helper
Several code paths in remote-curl.c follow the same pattern of calling
show_http_message() to display server error messages followed by die()
to terminate with an error. This duplication makes the code more verbose
and harder to maintain.
Introduce a new show_http_message_fatal() helper function that combines
these two operations. This function:
1. Displays any HTTP error message from the server via show_http_message()
2. Calls die() with the provided error message
3. Returns NORETURN to help the compiler with control flow analysis
Refactor existing call sites in remote-curl.c to use this new helper,
reducing code duplication and improving readability. This pattern will
also be used by upcoming HTTP 429 rate limiting support.
Suggested-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Vaidas Pilkauskas <vaidas.pilkauskas@shopify.com>1 parent 3e0b78c commit 973703e
1 file changed
+28
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
371 | | - | |
| 370 | + | |
| 371 | + | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
374 | 376 | | |
375 | 377 | | |
376 | 378 | | |
377 | 379 | | |
378 | 380 | | |
379 | 381 | | |
380 | | - | |
| 382 | + | |
381 | 383 | | |
382 | 384 | | |
383 | 385 | | |
384 | 386 | | |
385 | 387 | | |
386 | | - | |
| 388 | + | |
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
390 | 392 | | |
391 | 393 | | |
392 | 394 | | |
393 | 395 | | |
394 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
395 | 406 | | |
396 | 407 | | |
397 | 408 | | |
| |||
518 | 529 | | |
519 | 530 | | |
520 | 531 | | |
521 | | - | |
522 | | - | |
523 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
524 | 535 | | |
525 | | - | |
526 | | - | |
527 | | - | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
528 | 539 | | |
529 | | - | |
530 | | - | |
531 | | - | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
532 | 543 | | |
533 | | - | |
534 | | - | |
535 | | - | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
536 | 547 | | |
537 | 548 | | |
538 | 549 | | |
| |||
0 commit comments