Syntax
+ (void)noticeNetworkFailureForURL:(NSURL*)url httpMethod:(NSString*)httpMethod withTimer:(NRTimer*)timer andFailureCode:(NSInteger)iOSFailureCode;
Manually record a failed transactional network request.
Requirements
Compatible with all agent versions.
Description
Failed requests are requests that fail to receive a complete response from the server caused by things like TCP timeouts, SSL failures, connection closures, and more.
The failure codes you pass into this method should correlate to Apple's documented NSURLConnection failure codes.
Parameters
Parameter | Description |
---|---|
NSURL | Required. The URL of the request. |
string | Required. The HTTP method of the request. |
NRTimer | Required. A timer that captures the start and end of the request. |
NSInteger | Required. The failure codes you pass into this method should correlate to Apple's documented NSURLConnection failure codes. |
Examples
Objective-C
Example:
[NewRelic noticeNetworkFailureForURL:[NSURL URLWithString:@"https://www.newrelic.com"] httpMethod:@"GET" withTimer:[[NRTimer alloc] init] andFailureCode:NSURLErrorTimedOut];
Swift
Example:
NewRelic.noticeNetworkFailure(for: URL(string: "https://www.newrelic.com"), httpMethod: "GET", with: NRTimer(), andFailureCode: NSURLErrorTimedOut)