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

throw -> ASSERT

parent 5ad983ac
No related branches found
No related tags found
1 merge request!1351correct some ASSERT statements; convert many throw statements to ASSERT.
......@@ -14,6 +14,7 @@
#include "Img3D/View/Shader.h"
#include "Img3D/View/Camera.h"
#include "Base/Util/Assert.h"
#include <QMatrix4x4>
#include <stdexcept>
......@@ -44,15 +45,11 @@ void Shader::init()
return;
doInit = false;
auto shader_found =
addShaderFromSourceFile(QOpenGLShader::Vertex, ":/shaders/vertex_shader.vert");
if (!shader_found)
throw std::runtime_error("Bug in BornAgain configuration: couldn't load vertex shader");
auto ok = addShaderFromSourceFile(QOpenGLShader::Vertex, ":/shaders/vertex_shader.vert");
ASSERT(ok);
shader_found =
addShaderFromSourceFile(QOpenGLShader::Fragment, ":/shaders/fragment_shader.frag");
if (!shader_found)
throw std::runtime_error("Bug in BornAgain configuration: couldn't load fragment shader");
ok = addShaderFromSourceFile(QOpenGLShader::Fragment, ":/shaders/fragment_shader.frag");
ASSERT(ok);
bindAttributeLocation("vertex", 0);
bindAttributeLocation("normal", 1);
......
......@@ -15,12 +15,12 @@
#include "Sample/Particle/IFormFactor.h"
#include "Base/Py/PyFmt.h"
#include "Base/Types/Span.h"
#include "Base/Util/Assert.h"
#include "Base/Util/StringUtils.h"
#include "Base/Vector/WavevectorInfo.h"
#include "Sample/Particle/PolyhedralUtil.h"
#include "Sample/Scattering/Rotations.h"
#include "Sample/Shapes/IShape3D.h"
#include <stdexcept>
IFormFactor::IFormFactor() = default;
......@@ -38,8 +38,7 @@ double IFormFactor::volume() const
Span IFormFactor::spanZ(const IRotation* rotation) const
{
if (!m_shape3D)
throw std::runtime_error("Bug: Form factor has no m_shape3D, cannot compute top z");
ASSERT(m_shape3D);
return PolyhedralUtil::spanZ(m_shape3D->vertices(), rotation);
}
......
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