Skip to content

Commit

Permalink
fix: Remove BoundCylinderToZPhi final, add exception (#3926)
Browse files Browse the repository at this point in the history
- I missed a `final` in one location (see #3923)
- Adding an exception to `GridAccessJsonConverter::toJson`. This was previously silently returning an empty json object if none of the downcasts worked. Since the downcast chain is not exhaustive, I think it's better to throw if there's an unhandled case.
  • Loading branch information
paulgessinger authored Dec 3, 2024
1 parent 797c3c3 commit d806df0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Core/include/Acts/Utilities/GridAccessHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class LocalSubspace : public IBoundToGridLocal {
}
};

class BoundCylinderToZPhi final : public IBoundToGridLocal {
class BoundCylinderToZPhi : public IBoundToGridLocal {
public:
double radius = 1.;
double shift = 0.;
Expand Down
5 changes: 5 additions & 0 deletions Plugins/Json/src/GridJsonConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ nlohmann::json Acts::GridAccessJsonConverter::toJson(
jBoundToGridLocal["shift"] = boundCylinderToZPhi->shift;
}

if (jBoundToGridLocal.empty()) {
throw std::invalid_argument(
"GridAccessJsonConverter: boundToGridLocal type not supported.");
}

return jBoundToGridLocal;
}

Expand Down

0 comments on commit d806df0

Please sign in to comment.