Isolate util/executable
This commit is contained in:
parent
3a6ad72ac1
commit
30cafc553a
8
lib/spack/spack/util/error.py
Normal file
8
lib/spack/spack/util/error.py
Normal file
@ -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"""
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
|
|
||||||
import spack.error
|
import spack.util.error
|
||||||
|
|
||||||
__all__ = ["Executable", "which", "ProcessError"]
|
__all__ = ["Executable", "which", "ProcessError"]
|
||||||
|
|
||||||
@ -362,7 +362,10 @@ def which(*args, **kwargs):
|
|||||||
return Executable(exe) if exe else None
|
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."""
|
"""ProcessErrors are raised when Executables exit with an error code."""
|
||||||
|
|
||||||
|
|
||||||
@ -371,5 +374,5 @@ class ProcessTimeoutError(ProcessError):
|
|||||||
specified timeout exceed that time"""
|
specified timeout exceed that time"""
|
||||||
|
|
||||||
|
|
||||||
class CommandNotFoundError(spack.error.SpackError):
|
class CommandNotFoundError(EditorError):
|
||||||
"""Raised when ``which()`` can't find a required executable."""
|
"""Raised when ``which()`` can't find a required executable."""
|
||||||
|
Loading…
Reference in New Issue
Block a user