Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime van Kessel <nallath@gmail.com>2016-04-29 12:36:06 +0300
committerJaime van Kessel <nallath@gmail.com>2016-04-29 12:36:06 +0300
commit06dfb7360242fb0523c975f8d728f9ef245560f5 (patch)
treeb6de3adb20ef34886c7bdfd57eb0197e9e42ad57 /cura/MachineActionManager.py
parent46ff3f44089ea30c759133c4b563e5864c34241c (diff)
Exceptions are no longer general typed
CURA-1385
Diffstat (limited to 'cura/MachineActionManager.py')
-rw-r--r--cura/MachineActionManager.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/cura/MachineActionManager.py b/cura/MachineActionManager.py
index ff57a42803..1975ba35bc 100644
--- a/cura/MachineActionManager.py
+++ b/cura/MachineActionManager.py
@@ -3,6 +3,16 @@
from UM.Logger import Logger
+## Raised when trying to add an unknown machine action as a required action
+class UnknownMachineAction(Exception):
+ pass
+
+
+## Raised when trying to add a machine action that does not have an unique key.
+class NotUniqueMachineAction(Exception):
+ pass
+
+
class MachineActionManager:
def __init__(self):
## Dict of all known machine actions
@@ -26,8 +36,7 @@ class MachineActionManager:
else:
self._required_actions[machine] = set(self._machine_actions[action_key])
else:
- # Todo: define specific Exception types (instead of general type)
- raise Exception("Action %s, which is required for %s is not known." % (action_key, machine.getKey()))
+ raise UnknownMachineAction("Action %s, which is required for %s is not known." % (action_key, machine.getKey()))
## Add a supported action to a machine.
def addSupportedAction(self, machine, action_key):
@@ -55,8 +64,7 @@ class MachineActionManager:
if action.getKey() not in self._machine_action:
self._machine_action[action.getKey()] = action
else:
- # Todo: define specific Exception types (instead of general type)
- raise Exception("MachineAction with key %s was already added. Actions must have unique keys.", action.getKey())
+ raise NotUniqueMachineAction("MachineAction with key %s was already added. Actions must have unique keys.", action.getKey())
## Get all actions supported by given machine
# \param machine The machine you want the supported actions of