IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 8bab4ad0 authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by Maximilian Reininghaus
Browse files

throw exception if conversion impossible

parent fa446e4a
No related branches found
No related tags found
1 merge request!153Resolve "Release-type tests fail for cascade_example"
Pipeline #901 passed
......@@ -13,7 +13,7 @@
#include <corsika/particles/ParticleProperties.h>
#include <map>
#include <string>
namespace corsika::process::sibyll {
......@@ -28,7 +28,14 @@ namespace corsika::process::sibyll {
}
corsika::particles::Code constexpr ConvertFromSibyll(SibyllCode pCode) {
return sibyll2corsika[static_cast<SibyllCodeIntType>(pCode) - minSibyll];
auto const s = static_cast<SibyllCodeIntType>(pCode);
auto const corsikaCode = sibyll2corsika[s - minSibyll];
if (corsikaCode == corsika::particles::Code::Unknown) {
throw std::runtime_error(std::string("SIBYLL/CORSIKA conversion of ")
.append(std::to_string(s))
.append(" impossible"));
}
return corsikaCode;
}
int constexpr ConvertToSibyllRaw(corsika::particles::Code pCode) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment