From 2c5352adcc00b6779c47870ca859cba4eff251e4 Mon Sep 17 00:00:00 2001 From: Chaz Larson Date: Thu, 26 Dec 2024 15:15:11 -0600 Subject: [PATCH] [32] Friendlier tab message (#2381) --- VERSION | 2 +- modules/request.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 975c3b1e..a60f8690 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.1.0-build31 +2.1.0-build32 diff --git a/modules/request.py b/modules/request.py index 59dcab77..ad93bef6 100644 --- a/modules/request.py +++ b/modules/request.py @@ -259,7 +259,12 @@ class YAML: with open(self.path, encoding="utf-8") as fp: self.data = self.yaml.load(fp) except ruamel.yaml.error.YAMLError as e: - e = str(e).replace("\n", "\n ") + if "found character '\\t' that cannot start any token" in e.problem: + location = f"{e.args[3].name}; line {e.args[3].line + 1} column {e.args[3].column + 1}" + e = f"Tabs are not allowed in YAML files; only spaces are allowed.\nfirst tab character found at:\n{location}" + else: + e = str(e).replace("\n", "\n ") + raise Failed(f"YAML Error: {e}") except Exception as e: raise Failed(f"YAML Error: {e}")