Skip to content

Commit

Permalink
Add exception handling to omni Services
Browse files Browse the repository at this point in the history
This will make it easier to debug plugin initialization problems
  • Loading branch information
nathanwbrei committed Apr 18, 2024
1 parent 6052b48 commit 2775120
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libraries/JANA/Omni/JComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ class JComponent::Service : public JComponent::ServiceBase {
}

ServiceT& operator()() {
if (m_data == nullptr) {
throw JException("Attempted to access a Service which hasn't been attached to this Component yet!");
}
return *m_data;
}

ServiceT& operator->() {
if (m_data == nullptr) {
throw JException("Attempted to access a Service which hasn't been attached to this Component yet!");
}
return *m_data;
}

Expand Down

0 comments on commit 2775120

Please sign in to comment.