Просмотр исходного кода

Catch exceptions thrown by `[value description]`

Tanner Bennett лет назад: 8
Родитель
Сommit
a6ad98dd53
1 измененных файлов с 8 добавлено и 4 удалено
  1. 8 4
      Classes/Utility/FLEXRuntimeUtility.m

+ 8 - 4
Classes/Utility/FLEXRuntimeUtility.m

@@ -155,10 +155,14 @@ const unsigned int kFLEXNumberOfImplicitArgs = 2;
         }
         }
     }
     }
     
     
-    if (!description) {
-        // Single line display - replace newlines and tabs with spaces.
-        description = [[value description] stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
-        description = [description stringByReplacingOccurrencesOfString:@"\t" withString:@" "];
+    @try {
+        if (!description) {
+            // Single line display - replace newlines and tabs with spaces.
+            description = [[value description] stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
+            description = [description stringByReplacingOccurrencesOfString:@"\t" withString:@" "];
+        }
+    } @catch (NSException *e) {
+        description = [@"Thrown: " stringByAppendingString:e.reason ?: @"(nil exception reason)"];
     }
     }
     
     
     if (!description) {
     if (!description) {