Commits

Bart van Strien committed e685f56

Some exception cleanup

Comments (0)

Files changed (4)

src/common/Exception.cpp

 		va_end(args);
 	}
 
+	Exception::Exception(int unparsed, const char * str)
+	{
+		strncpy(buffer, str, BUFFER_SIZE);
+	}
+
 	const char * Exception::what() const throw()
 	{
 		return (const char *)buffer;

src/common/Exception.h

 #include <exception>
 #include <cstdarg> // vararg
 #include <cstdio> // vsnprintf
+#include <cstring> // strncpy
 
 namespace love
 {
 		* @param fmt The format string (see printf).
 		**/
 		Exception(const char * fmt, ...);
+		Exception(int unparsed, const char * str);
 
 		/**
 		* Returns a string containing reason for the exception.

src/modules/graphics/opengl/Font.cpp

 				dx += glyph->spacing;
 			}
 		}
-		catch (utf8::invalid_code_point e)
+		catch (utf8::exception & e)
 		{
 			glPopMatrix();
-			throw love::Exception(e.what());
-		}
-		catch (utf8::invalid_utf8 e)
-		{
-			glPopMatrix();
-			throw love::Exception(e.what());
-		}
-		catch (utf8::exception e)
-		{
-			glPopMatrix();
-			throw love::Exception(e.what());
+			throw love::Exception(1, e.what());
 		}
 		glPopMatrix();
 	}
 				temp += static_cast<int>(g->spacing * mSpacing);
 			}
 		}
-		catch (utf8::invalid_code_point e)
+		catch (utf8::exception & e)
 		{
-			glPopMatrix();
-			throw love::Exception(e.what());
-		}
-		catch (utf8::invalid_utf8 e)
-		{
-			glPopMatrix();
-			throw love::Exception(e.what());
-		}
-		catch (utf8::exception e)
-		{
-			throw love::Exception(e.what());
+			throw love::Exception(1, e.what());
 		}
 
 		return temp;

src/modules/physics/box2d/Source/Common/b2Settings.h

 
 #define B2_NOT_USED(x) x
 //#define b2Assert(A) assert(A)
-#define b2Assert(A) {if(!(A)) throw love::Exception(#A);}
+#define b2Assert(A) {if(!(A)) throw love::Exception(1, #A);}
 
 
 // need to include NDS jtypes.h instead of