mirror of
https://github.com/love2d/love.git
synced 2026-08-14 10:13:46 +02:00
Some exception cleanup
This commit is contained in:
@@ -30,6 +30,11 @@ namespace love
|
||||
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;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <exception>
|
||||
#include <cstdarg> // vararg
|
||||
#include <cstdio> // vsnprintf
|
||||
#include <cstring> // strncpy
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -54,6 +55,7 @@ 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.
|
||||
|
||||
@@ -174,20 +174,10 @@ namespace opengl
|
||||
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();
|
||||
}
|
||||
@@ -220,19 +210,9 @@ namespace opengl
|
||||
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;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user