Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25906] : iOS Native exceptions not thrown when using run-on-main-thread #9966

Merged
merged 2 commits into from
May 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions iphone/Classes/TiBase.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,8 @@ void TiLogMessage(NSString *str, ...)

void TiExceptionThrowWithNameAndReason(NSString *exceptionName, NSString *reason, NSString *subreason, NSString *location)
{
if (TiExceptionIsSafeOnMainThread || ![NSThread isMainThread]) {
NSDictionary *details = [NSDictionary dictionaryWithObjectsAndKeys:subreason, kTiExceptionSubreason, location, kTiExceptionLocation, nil];
@throw [NSException exceptionWithName:exceptionName reason:reason userInfo:details];
} else {
NSString *message = [NSString stringWithFormat:@"%@. %@ %@", reason, (subreason != nil ? subreason : @""), (location != nil ? location : @"")];
NSLog(@"[ERROR] %@", message);
}
NSDictionary *details = [NSDictionary dictionaryWithObjectsAndKeys:subreason, kTiExceptionSubreason, location, kTiExceptionLocation, nil];
@throw [NSException exceptionWithName:exceptionName reason:reason userInfo:details];
}

NSString *JavascriptNameForClass(Class c)
Expand Down
20 changes: 20 additions & 0 deletions tests/Resources/ti.xml.addontest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Appcelerator Titanium Mobile
* Copyright (c) 2011-Present by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
/* eslint-env mocha */
/* global Ti */
/* eslint no-unused-expressions: "off" */
'use strict';
var should = require('./utilities/assertions');

describe.windowsDesktopBroken('Titanium.XML', function () {
it.ios('parseString (invalid xml)', function () {
should(Ti.XML.parseString).be.a.Function;
should(function () {
var xml = Ti.XML.parseString('invalid XML');
}).throw();
});
});