Skip to content

Commit

Permalink
Raise proper exceptions in python generators
Browse files Browse the repository at this point in the history
  • Loading branch information
redixin committed Sep 19, 2022
1 parent 85c5579 commit 6282eb1
Show file tree
Hide file tree
Showing 34 changed files with 78 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ def __call__(self, args):
Main execution point.
Calls the accept method on each visitor to generate the code.
"""
raise Exception(
raise NotImplementedError(
"AbstractGenerator.__call__() - Implementation Error: you must supply your own concrete implementation."
)

def accept(self, visitor):
"""
Execute the visit call on this object.
"""
raise Exception(
raise NotImplementedError(
"AbstractFace.accept.accept(v) - Implementation Error: you must supply your own concrete implementation."
)

def addVisitor(self, visitor):
"""
Method to add the visitor to a list of visitors.
"""
raise Exception(
raise NotImplementedError(
"AbstractFace.accept.addVisitor(v) - Implementation Error: you must supply your own concrete implementation."
)
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/ChannelBody.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"ChannelBody.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"ChannelBody.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"ChannelBody.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"ChannelBody.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/ChannelHeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"ChannelHeader.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"ChannelHeader.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"ChannelHeader.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"ChannelHeader.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/CommandBody.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"startCommandVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"startCommandVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"startCommandVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"startCommandVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/CommandHeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"CommandHeader.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"CommandHeader.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"CommandHeader.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"CommandHeader.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/DictBody.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"DictBodyVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"DictBodyVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"DictBodyVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"DictBodyVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/DictHeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"DictHeaderVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"DictHeaderVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"DictHeaderVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"DictHeaderVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/DictStart.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"DictStartVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"DictStartVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"DictStartVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"DictStartVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/EventBody.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"EventBody.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"EventBody.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"EventBody.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"EventBody.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/EventHeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"EventHeader.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"EventHeader.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"EventHeader.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"EventHeader.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/FinishSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"FinishSource.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"FinishSource.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"FinishSource.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"FinishSource.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/HtmlDocPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"HtmlDoc.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"HtmlDoc.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"HtmlDoc.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"HtmlDoc.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/HtmlStartPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"HtmlStartPage.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"HtmlStartPage.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"HtmlStartPage.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"HtmlStartPage.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/Includes1.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"Includes1.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"Includes1.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"Includes1.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"Includes1.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/Includes2.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"Includes2.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"Includes2.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"Includes2.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"Includes2.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/InitFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def accept(self, visitor):
DEBUG.error(
"InitFiles.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"InitFiles.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -95,7 +95,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"InitFiles.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"InitFiles.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor, topology_model):
DEBUG.error(
"InstanceDictBodyVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"InstanceDictBodyVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"InstanceDictBodyVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"InstanceDictBodyVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor, topology_model):
DEBUG.error(
"InstanceDictHeaderVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"InstanceDictHeaderVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"InstanceDictHeaderVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"InstanceDictHeaderVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor, topology_model):
DEBUG.error(
"InstanceDictStartVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"InstanceDictStartVisit.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"InstanceDictStartVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"InstanceDictStartVisit.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/MdDocPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"MdDoc.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"MdDoc.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"MdDoc.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"MdDoc.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/src/fprime_ac/generators/MdStartPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def accept(self, visitor):
DEBUG.error(
"MDStartPage.accept() - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"MdStartPage.accept() - the given visitor is not a subclass of AbstractVisitor!"
)

Expand All @@ -94,7 +94,7 @@ def addVisitor(self, visitor):
DEBUG.error(
"MdStartPage.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)
raise Exception(
raise TypeError(
"MdStartPage.addVisitor(v) - the given visitor is not a subclass of AbstractVisitor!"
)

Expand Down

0 comments on commit 6282eb1

Please sign in to comment.