From d360a92c5b0b55c19174890fddfe380a649a0dc5 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 25 Mar 2025 17:10:36 +0100
Subject: [PATCH] Minor refactoring.

---
 testing/scripts/_config_scripts_lib.sh | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/testing/scripts/_config_scripts_lib.sh b/testing/scripts/_config_scripts_lib.sh
index 2594682..62f9fcc 100644
--- a/testing/scripts/_config_scripts_lib.sh
+++ b/testing/scripts/_config_scripts_lib.sh
@@ -18,23 +18,25 @@ expect_min_n_args() {
     fi
 }
 
+_abort() {
+    echo "Aborting: $1"
+    exit 1
+}
+
 abort_if_exists() {
     if [ -e "$1" ]; then
-        echo "Aborting because $1 already exists."
-        exit 1
+        _abort "$1 already exists."
     fi
 }
 
 abort_if_not_user() {
     if [ "$(whoami)" != "$1" ]; then
-        echo "Must be run as ${1}."
-        exit 1
+        _abort "Must be run as ${1}."
     fi
 }
 
 abort_if_offline() {
     if ! ping -c1 -W2 1.1.1.1 > /dev/null 2>&1; then
-        echo "Must be run online."
-        exit 1
+        _abort 'Must be run online.'
     fi
 }
-- 
2.30.2