diff --git a/fortls/debug.py b/fortls/debug.py index 7e7a5e48..3e8dbc07 100644 --- a/fortls/debug.py +++ b/fortls/debug.py @@ -7,6 +7,7 @@ import json5 +from .exceptions import DebugError, ParameterError, ParserError from .helper_functions import only_dirs, resolve_globs from .jsonrpc import JSONRPC2Connection, ReadWriter, path_from_uri from .langserver import LangServer diff --git a/fortls/exceptions.py b/fortls/exceptions.py new file mode 100644 index 00000000..654788b2 --- /dev/null +++ b/fortls/exceptions.py @@ -0,0 +1,17 @@ +from __future__ import annotations + + +class DebugError(Exception): + """Base class for debug CLI.""" + + +class ParameterError(DebugError): + """Exception raised for errors in the parameters.""" + + +class ParserError(Exception): + """Parser base class exception""" + + +class FortranFileNotFoundError(ParserError, FileNotFoundError): + """File not found""" diff --git a/fortls/parsers/internal/parser.py b/fortls/parsers/internal/parser.py index d48a0dac..56c54146 100644 --- a/fortls/parsers/internal/parser.py +++ b/fortls/parsers/internal/parser.py @@ -24,6 +24,7 @@ Severity, log, ) +from fortls.exceptions import FortranFileNotFoundError from fortls.ftypes import ( ClassInfo, FunSig, @@ -2303,11 +2304,3 @@ def find_file_in_directories(directories: Iterable[str], filename: str) -> str: line = line_new output_file.append(line) return output_file, pp_skips, pp_defines, defs_tmp - - -class ParserError(Exception): - """Parser base class exception""" - - -class FortranFileNotFoundError(ParserError, FileNotFoundError): - """File not found"""