Hi,
I was looking at the blog post on using await with closure callbacks, it doesnt seem possible to step through or catch the exception that is thrown.
This is my download method
method DownloadData;
begin
try
var url := Url.TryUrlWithString('http://api.isailed.com/');
var aResponse := await Http.ExecuteRequestAsJson(new HttpRequest(url));
if assigned(aResponse.Content) then
begin
await dispatch_async(dispatch_get_main_queue());
var fData := aResponse.Content;
end;
except
on E:NSException do
begin
NSLog('%@',$'{E.Message}');
end;
end;
end;
I see this in the log when running in the simulator
~> Please note: The debugger cannot capture StdOut (from print()
or writeLn()
) from the Simulator. NSLog()
will be visible.
~> Process AwaitClosuresApp started
2019-07-03 23:15:33.377805-0400 AwaitClosuresApp[99192:45746664] SecTaskLoadEntitlements failed error=22 cs_flags=220, pid=99192
2019-07-03 23:15:33.378538-0400 AwaitClosuresApp[99192:45746664] SecTaskCopyDebugDescription: AwaitClosuresApp[99192]/0#-1 LF=0
2019-07-03 23:15:33.384420-0400 AwaitClosuresApp[99192:45747469] [general] CFLocaleCopyCurrent() failed to look up current locale via ‘AppleLocale’ and ‘AppleLanguages’ in user preferences; falling back to locale identifier ‘en_US’ as the default. Consider checking Console for sandbox violations from this process for reading from preferences, or enabling CoreFoundation debug logging for more information. This will only be logged once.
2019-07-03 23:15:33.428496-0400 AwaitClosuresApp[99192:45746664] SecTaskLoadEntitlements failed error=22 cs_flags=220, pid=99192
2019-07-03 23:15:33.428848-0400 AwaitClosuresApp[99192:45746664] SecTaskCopyDebugDescription: AwaitClosuresApp[99192]/0#-1 LF=0
2019-07-03 23:17:59.366033-0400 AwaitClosuresApp[99192:45747470] NSURLSessionEffectiveConfiguration - _socketStreamProperties is a connection property
2019-07-03 23:17:59.509950-0400 AwaitClosuresApp[99192:45747479] SecTaskLoadEntitlements failed error=22 cs_flags=220, pid=99192
2019-07-03 23:17:59.510780-0400 AwaitClosuresApp[99192:45747479] SecTaskCopyDebugDescription: AwaitClosuresApp[99192]/0#-1 LF=0
2019-07-03 23:17:59.593098-0400 AwaitClosuresApp[99192:45747479] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
2019-07-03 23:17:59.677028-0400 AwaitClosuresApp[99192:45747479] [unspecified] container_system_group_path_for_identifier: error = (container_error_t)53
~> Ignored exception of type NSException on thread 09E8
~> Message: Null Reference Exception for expression: self.aResponse
2019-07-03 23:18:41.510288-0400 AwaitClosuresApp[99192:45746664] Null Reference Exception for expression: self.aResponse
I have a breakpoint on the first await which is hit but the next thing I see is the message in the log about the exception.
Should be able to catch the exception ? And should I be able to step into or through the code ?
This is the example.
AwaitClosuresApp.zip (1.4 MB)
Cheers,
John