ObjFW  Diff

Differences From Artifact [b853bc24af]:

To Artifact [47ee1ec6b0]:


15
16
17
18
19
20
21
22
23
24


25
26
27
28
29
30
31
 */

#include "config.h"

#import "OFHTTPRequestFailedException.h"
#import "OFString.h"
#import "OFHTTPRequest.h"
#import "OFAutoreleasePool.h"

#import "OFNotImplementedException.h"



@implementation OFHTTPRequestFailedException
+ exceptionWithClass: (Class)class_
	 HTTPRequest: (OFHTTPRequest*)request
	      result: (OFHTTPRequestResult*)result
{
	return [[[self alloc] initWithClass: class_







<


>
>







15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
30
31
32
 */

#include "config.h"

#import "OFHTTPRequestFailedException.h"
#import "OFString.h"
#import "OFHTTPRequest.h"


#import "OFNotImplementedException.h"

#import "autorelease.h"

@implementation OFHTTPRequestFailedException
+ exceptionWithClass: (Class)class_
	 HTTPRequest: (OFHTTPRequest*)request
	      result: (OFHTTPRequestResult*)result
{
	return [[[self alloc] initWithClass: class_
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
	[result release];

	[super dealloc];
}

- (OFString*)description
{
	OFAutoreleasePool *pool;
	const char *type = "(unknown)";

	if (description != nil)
		return description;

	switch ([HTTPRequest requestType]) {
	case OF_HTTP_REQUEST_TYPE_GET:
		type = "GET";
		break;
	case OF_HTTP_REQUEST_TYPE_HEAD:
		type = "HEAD";
		break;
	case OF_HTTP_REQUEST_TYPE_POST:
		type = "POST";
		break;
	}

	pool = [[OFAutoreleasePool alloc] init];

	description = [[OFString alloc] initWithFormat:
	    @"A HTTP %s request in class %@ with URL %@ failed with code %d",
	    type, inClass, [HTTPRequest URL], [result statusCode]];

	[pool release];

	return description;
}

- (OFHTTPRequest*)HTTPRequest
{
	return HTTPRequest;







|

















|





|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
	[result release];

	[super dealloc];
}

- (OFString*)description
{
	void *pool;
	const char *type = "(unknown)";

	if (description != nil)
		return description;

	switch ([HTTPRequest requestType]) {
	case OF_HTTP_REQUEST_TYPE_GET:
		type = "GET";
		break;
	case OF_HTTP_REQUEST_TYPE_HEAD:
		type = "HEAD";
		break;
	case OF_HTTP_REQUEST_TYPE_POST:
		type = "POST";
		break;
	}

	pool = objc_autoreleasePoolPush();

	description = [[OFString alloc] initWithFormat:
	    @"A HTTP %s request in class %@ with URL %@ failed with code %d",
	    type, inClass, [HTTPRequest URL], [result statusCode]];

	objc_autoreleasePoolPop(pool);

	return description;
}

- (OFHTTPRequest*)HTTPRequest
{
	return HTTPRequest;