Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add error handling in -[MLCState loadScript:error:], printing any err…

…ors that occur
  • Loading branch information...
commit d790fb217f33d4b87cf45d89be2ec61d593f6e19 1 parent 0771025
@jspahrsummers jspahrsummers authored
View
1  Framework/MoonlitCocoa/MoonlitCocoa/MLCBridgedObject.m
@@ -326,7 +326,6 @@ - (void)forwardInvocation:(NSInvocation *)invocation {
}
[state popReturnValueForInvocation:invocation];
-
return YES;
}];
}
View
13 Framework/MoonlitCocoa/MoonlitCocoa/MLCState.m
@@ -199,9 +199,20 @@ - (BOOL)loadScript:(NSString *)source error:(NSError **)error; {
[source pushOntoStack:self];
+ NSError *localError = nil;
+
// on the stack should be:
// { compiler.loadstring, source }
- return [self callFunctionWithArgumentCount:1 resultCount:1 error:error];
+ if (![self callFunctionWithArgumentCount:1 resultCount:1 error:&localError]) {
+ NSLog(@"Could not load script: %@", localError);
+
+ if (error)
+ *error = localError;
+
+ return NO;
+ } else {
+ return YES;
+ }
}];
}
Please sign in to comment.
Something went wrong with that request. Please try again.