Skip to content

Commit adbd4d0

Browse files
authored
feat: Account for new error class (#177)
1 parent cdb48ef commit adbd4d0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ci-scripts/helper-error-report.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,30 @@ error_unknown=0
1717
error_504=0
1818
error_503=0
1919
error_502=0
20+
error_401=0
2021
error_remoteclose=0
2122

2223
heading=""
2324
final_csv=""
2425

2526
function cleanup_errors() {
27+
error_unknown=0
2628
error_504=0
2729
error_503=0
2830
error_502=0
31+
error_401=0
2932
error_remoteclose=0
30-
error_unknown=0
3133
}
3234

3335
function show_errors() {
3436
echo "=== $heading ==="
3537
echo "504 Server Error: Gateway Time-out for url: $error_504"
3638
echo "503 Server Error: Service Unavailable for url: $error_503"
3739
echo "502 Server Error: Bad Gateway for url: $error_502"
40+
echo "401 Client Error: Unauthorized for url: $error_401"
3841
echo "Remote end closed connection without response: $error_remoteclose"
3942
echo "Not recognized error: $error_unknown"
40-
final_csv="${final_csv}${heading},${log_url},${error_504},${error_503},${error_502},${error_remoteclose},${error_unknown}\n"
43+
final_csv="${final_csv}${heading},${log_url},${error_504},${error_503},${error_502},${error_401},${error_remoteclose},${error_unknown}\n"
4144
}
4245

4346
# Why this fifo? See https://jhutar.blogspot.com/2024/12/bash-while-read-line-without-subshell.html
@@ -72,6 +75,12 @@ while IFS=$'\n' read -r line; do
7275
count="${numbers[0]}"
7376
(( error_502+=count ))
7477
;;
78+
*"401 Client Error: Unauthorized for url: "*)
79+
# shellcheck disable=SC2206
80+
numbers=( ${line//[!0-9]/ } )
81+
count="${numbers[0]}"
82+
(( error_401+=count ))
83+
;;
7584
*"Remote end closed connection without response"*)
7685
# shellcheck disable=SC2206
7786
numbers=( ${line//[!0-9]/ } )
@@ -91,5 +100,5 @@ done < "$TMPFIFODIR/mypipe"
91100
show_errors
92101

93102
echo -e "\nIn CSV form:\n"
94-
echo "Scenario,Log,504 Server Error: Gateway Time-out for url: ...,503 Server Error: Service Unavailable for url: ...,502 Server Error: Bad Gateway for url: ...,Remote end closed connection without response,Not recognized error"
103+
echo "Scenario,Log,504 Server Error: Gateway Time-out for url: ...,503 Server Error: Service Unavailable for url: ...,502 Server Error: Bad Gateway for url: ...,401 Client Error: Unauthorized for url: ...,Remote end closed connection without response,Not recognized error"
95104
echo -e "$final_csv"

0 commit comments

Comments
 (0)