Skip to content

Commit

Permalink
[TIMOB-26007] Fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed May 4, 2018
1 parent 8d6fcc9 commit ad73fd7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
24 changes: 12 additions & 12 deletions iphone/Classes/TiBindingTiValue.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,24 @@
TiStringRef stackKeyRef = TiStringCreateWithUTF8CString("stack");
TiValueRef messageRef = TiObjectGetProperty(jsContext, obj, messageKeyRef, NULL);
TiValueRef stackRef = TiObjectGetProperty(jsContext, obj, stackKeyRef, NULL);

id message = TiBindingTiValueToNSObject(jsContext, messageRef);
if (message && ![message isEqual:[NSNull null]]) {
[dict setObject:message forKey:@"message"];
[dict setObject:message forKey:@"message"];
}
TiStringRelease(messageKeyRef);

id stack = TiBindingTiValueToNSObject(jsContext, stackRef);
if (stack && ![stack isEqual:[NSNull null]]) {
// lets re-format the stack similar to node.js
stack = [stack stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"file://%@", [[NSBundle mainBundle] bundlePath]] withString:@"("];
stack = [stack stringByReplacingOccurrencesOfString:@"\n" withString:@")\n at "];
stack = [stack stringByReplacingOccurrencesOfString:@"])" withString:@"]"];
stack = [stack stringByReplacingOccurrencesOfString:@"@(" withString:@"("];
stack = [NSString stringWithFormat:@" at %@)", stack];
[dict setObject:stack forKey:@"stack"];

// lets re-format the stack similar to node.js
stack = [stack stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"file://%@", [[NSBundle mainBundle] bundlePath]] withString:@"("];
stack = [stack stringByReplacingOccurrencesOfString:@"\n" withString:@")\n at "];
stack = [stack stringByReplacingOccurrencesOfString:@"])" withString:@"]"];
stack = [stack stringByReplacingOccurrencesOfString:@"@(" withString:@"("];
stack = [NSString stringWithFormat:@" at %@)", stack];

[dict setObject:stack forKey:@"stack"];
}
TiStringRelease(stackKeyRef);
}
Expand Down
8 changes: 4 additions & 4 deletions iphone/Classes/TiErrorController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ - (void)loadView
{
[super loadView];
self.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
UIScrollView* view = [[[NSBundle mainBundle] loadNibNamed:@"ErrorScreen" owner:self options:nil] objectAtIndex:0];

UIScrollView *view = [[[NSBundle mainBundle] loadNibNamed:@"ErrorScreen" owner:self options:nil] objectAtIndex:0];
self.view = view;

UITextView* text = (UITextView*)[self.view viewWithTag:1];
UITextView *text = (UITextView *)[self.view viewWithTag:1];
[text setText:error];

// re-size for scroll
text.contentSize = [text sizeThatFits:CGSizeMake(FLT_MAX, FLT_MAX)];
text.frame = CGRectMake(text.frame.origin.x, text.frame.origin.y, text.contentSize.width, text.contentSize.height);
Expand Down
10 changes: 5 additions & 5 deletions iphone/Classes/TiExceptionHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ + (TiExceptionHandler *)defaultExceptionHandler

- (void)reportException:(NSException *)exception
{
NSArray* stackTrace = [exception callStackSymbols];
NSArray *stackTrace = [exception callStackSymbols];
NSString *message = [NSString stringWithFormat:
@"[ERROR] The application has crashed with an uncaught exception '%@'.\nReason:\n%@\nStack trace:\n\n%@\n",
exception.name, exception.reason, [stackTrace componentsJoinedByString:@"\n"]];
Expand Down Expand Up @@ -130,10 +130,10 @@ - (void)dealloc
- (NSString *)description
{
if (self.sourceURL != nil) {
NSString* source = [NSString stringWithContentsOfFile:[[NSURL URLWithString:self.sourceURL] path] encoding:NSUTF8StringEncoding error:NULL];
NSArray* lines = [sourceString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
NSString* line = [lines objectAtIndex:self.lineNo - 1];
NSString* linePointer = [@"" stringByPaddingToLength:self.column withString:@" " startingAtIndex:0];
NSString *source = [NSString stringWithContentsOfFile:[[NSURL URLWithString:self.sourceURL] path] encoding:NSUTF8StringEncoding error:NULL];
NSArray *lines = [sourceString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];
NSString *line = [lines objectAtIndex:self.lineNo - 1];
NSString *linePointer = [@"" stringByPaddingToLength:self.column withString:@" " startingAtIndex:0];

return [NSString stringWithFormat:@"/%@:%ld\n%@\n%@^\n%@\n%@", [self.sourceURL lastPathComponent], (long)self.lineNo, line, linePointer, self.message, self.backtrace];
} else {
Expand Down

0 comments on commit ad73fd7

Please sign in to comment.