Skip to content
Snippets Groups Projects
Commit 7ff4e3a2 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

throw -> ASSERT

parent 9f024a19
No related branches found
No related tags found
1 merge request!228decouple CoordSystem2D from Beam, and minor cleanup in related context
......@@ -22,7 +22,6 @@
#include "Device/Coord/AxisNames.h"
#include <algorithm>
#include <cmath>
#include <stdexcept>
namespace {
......@@ -161,9 +160,7 @@ double SphericalCoords::calculateValue(size_t i_axis, Axes::Coords units, double
const auto k_f = vecOfLambdaAlphaPhi(m_wavelength, value, 0.0);
return (k_f - k_i).z();
}
throw std::runtime_error("Error in SphericalCoords::calculateValue: "
"incorrect axis index: "
+ std::to_string(static_cast<int>(i_axis)));
ASSERT(0);
}
case Axes::Coords::QXQY: {
const auto k_i = vecOfLambdaAlphaPhi(m_wavelength, m_alpha_i, m_phi_i);
......@@ -174,12 +171,10 @@ double SphericalCoords::calculateValue(size_t i_axis, Axes::Coords units, double
const auto k_f = vecOfLambdaAlphaPhi(m_wavelength, value, 0.0);
return (k_f - k_i).x();
}
throw std::runtime_error("Error in SphericalCoords::calculateValue: "
"incorrect axis index: "
+ std::to_string(static_cast<int>(i_axis)));
ASSERT(0);
}
default:
throwUnitsError("SphericalCoords::calculateValue", availableUnits());
ASSERT(0);
}
}
......@@ -259,7 +254,7 @@ double ImageCoords::calculateValue(size_t i_axis, Axes::Coords units, double val
default:
break;
}
throwUnitsError("ImageCoords::calculateValue", availableUnits());
ASSERT(0);
}
std::vector<std::map<Axes::Coords, std::string>> ImageCoords::createNameMaps() const
......@@ -328,7 +323,7 @@ double OffSpecularCoordinates::calculateValue(size_t, Axes::Coords units, double
case Axes::Coords::DEGREES:
return Units::rad2deg(value);
default:
throwUnitsError("OffSpecularCoordinates::calculateValue", availableUnits());
ASSERT(0);
}
}
......@@ -378,7 +373,7 @@ double DepthProbeCoordinates::calculateValue(size_t i_axis, Axes::Coords units,
{
const auto& available_units = availableUnits();
if (std::find(available_units.begin(), available_units.end(), units) == available_units.cend())
throwUnitsError("DepthProbeCoordinates::checkUnits", available_units);
ASSERT(0);
if (i_axis == 1)
return value; // unit conversions are not applied to sample position axis
......
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