Cleaned up JS exception wrapper stuff.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3588 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2010-06-22 18:08:10 +00:00
parent 6f9f338732
commit 5ea3215c1c
2 changed files with 4 additions and 7 deletions

View File

@ -406,17 +406,14 @@ void JSRegisterObjectConverter(JSClass *theClass, JSClassConverterCallback conve
OOJS_PROFILE_ENTER_FOR_NATIVE
#define OOJS_NATIVE_EXIT \
} @catch(NSException *exception) { \
} @catch(id exception) { \
OOJSReportWrappedException(oojsProfileContext, exception); \
return NO; \
} @catch(...) { \
OOJSReportWrappedException(oojsProfileContext, nil); \
return NO; \
OOJS_PROFILE_EXIT_VAL(NO) \
}
void OOJSReportWrappedException(JSContext *context, NSException *exception);
void OOJSReportWrappedException(JSContext *context, id exception);
#ifndef NDEBUG
void OOJSUnreachable(const char *function, const char *file, unsigned line) NO_RETURN_FUNC;

View File

@ -604,9 +604,9 @@ void OOReportJSErrorWithArguments(JSContext *context, NSString *format, va_list
#if OOLITE_NATIVE_EXCEPTIONS
void OOJSReportWrappedException(JSContext *context, NSException *exception)
void OOJSReportWrappedException(JSContext *context, id exception)
{
if (exception != nil) OOReportJSError(context, @"Native exception: %@", [exception reason]);
if ([exception isKindOfClass:[NSException class]]) OOReportJSError(context, @"Native exception: %@", [exception reason]);
else OOReportJSError(context, @"Unidentified native exception");
}