]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/glsl_error.h
Refactor error reporting in SL::Parser
[libs/gl.git] / source / glsl / glsl_error.h
diff --git a/source/glsl/glsl_error.h b/source/glsl/glsl_error.h
new file mode 100644 (file)
index 0000000..63c49bb
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef MSP_GL_SL_ERROR_H_
+#define MSP_GL_SL_ERROR_H_
+
+#include <stdexcept>
+#include <msp/strings/format.h>
+
+namespace Msp {
+namespace GL {
+namespace SL {
+
+struct Location;
+
+class invalid_shader_source: public std::runtime_error
+{
+public:
+       invalid_shader_source(const Location &, const std::string &);
+#if __cplusplus>=201103L
+       template<typename... Args>
+       invalid_shader_source(const Location &loc, const std::string & fmt, Args... args):
+               invalid_shader_source(loc, format(fmt, args...))
+       { }
+#endif
+       virtual ~invalid_shader_source() throw() { }
+};
+
+class parse_error: public invalid_shader_source
+{
+public:
+       parse_error(const Location &, const std::string &, const std::string &);
+       virtual ~parse_error() throw() { }
+};
+
+} // namespace SL
+} // namespace GL
+} // namespace Msp
+
+#endif