Skip to content

Commit

Permalink
raise error
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Peter committed Jun 20, 2023
1 parent a027a24 commit 16917ec
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spyder/plugins/run/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ def get_metadata_context_extension(self, uuid: str):

def set_current_run_configuration(self, uuid: str):
self.current_configuration = uuid
if self.current_configuration not in self.inverted_index:
raise RuntimeError("Invalid configuartion")

def get_current_run_configuration(self):
return self.current_configuration
Expand Down Expand Up @@ -240,6 +242,9 @@ def pop(self, uuid: str) -> RunConfigurationMetadata:
item = self.run_configurations.pop(uuid)
self.metadata_index = dict(enumerate(self.run_configurations))
self.inverted_index = {v: k for k, v in self.metadata_index.items()}
if self.current_configuration not in self.inverted_index:
self.current_configuration = None
raise RuntimeError("Cannot remove current configuartion")
self.dataChanged.emit(self.createIndex(0, 0),
self.createIndex(len(self.metadata_index), 0))
return item
Expand Down

0 comments on commit 16917ec

Please sign in to comment.