From 30cafc553a0e3195a43a5bc48404bc1b79eca1ec Mon Sep 17 00:00:00 2001 From: Douglas Jacobsen Date: Thu, 12 Oct 2023 14:54:43 -0600 Subject: [PATCH] Isolate util/executable --- lib/spack/spack/util/error.py | 8 ++++++++ lib/spack/spack/util/executable.py | 9 ++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 lib/spack/spack/util/error.py diff --git a/lib/spack/spack/util/error.py b/lib/spack/spack/util/error.py new file mode 100644 index 00000000000..cd979839f2d --- /dev/null +++ b/lib/spack/spack/util/error.py @@ -0,0 +1,8 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +class UtilityError(Exception): + """Base error for all errors from the utility package""" diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py index 36c7e73e063..1e210906a09 100644 --- a/lib/spack/spack/util/executable.py +++ b/lib/spack/spack/util/executable.py @@ -11,7 +11,7 @@ import llnl.util.tty as tty -import spack.error +import spack.util.error __all__ = ["Executable", "which", "ProcessError"] @@ -362,7 +362,10 @@ def which(*args, **kwargs): return Executable(exe) if exe else None -class ProcessError(spack.error.SpackError): +class EditorError(spack.util.error.UtilityError): + """Base error for all errors from the executable utility""" + +class ProcessError(EditorError): """ProcessErrors are raised when Executables exit with an error code.""" @@ -371,5 +374,5 @@ class ProcessTimeoutError(ProcessError): specified timeout exceed that time""" -class CommandNotFoundError(spack.error.SpackError): +class CommandNotFoundError(EditorError): """Raised when ``which()`` can't find a required executable."""