xref: /petsc/lib/petsc/bin/maint/petsclinter/petsclinter/_error.py (revision 4c7cc9c8e01791debde927bc0816c9a347055c8f)
1#!/usr/bin/env python3
2"""
3# Created: Mon Jun 20 19:29:45 2022 (-0400)
4# @author: Jacob Faibussowitsch
5"""
6class BaseError(Exception):
7  """
8  Base class exception for all exceptions defined in PetscLinter
9  """
10  pass
11
12class ParsingError(BaseError):
13  """
14  Mostly to just have a custom "something went wrong when trying to perform a check" to except
15  for rather than using a built-in type. These are errors that are meant to be caught and logged
16  rather than stopping execution alltogether.
17
18  This should make it so that actual errors aren't hidden.
19  """
20  pass
21
22class KnownUnhandleableCursorError(ParsingError):
23  """
24  For whatever reason (perhaps because its macro stringization hell) PETSC_HASH_MAP
25  and PetscKernel_XXX absolutely __brick__ the AST. The resultant cursors have no
26  children, no name, no tokens, and a completely incorrect SourceLocation. They are for
27  all intents and purposes uncheckable :)
28  """
29  pass
30
31class ClassidNotRegisteredError(BaseError):
32  """
33  An error to indicate that a particular object has not been registered in the classid map
34  """
35  pass
36
37class TimeoutError(BaseError):
38  r"""An error to indicate some operation timed out"""
39  pass
40
41class ClobberTestOutputError(BaseError):
42  r"""An error to indicate you are about to clobbber your test code output with patches"""
43  pass
44