ObjFW  Diff

Differences From Artifact [6a16e70139]:

To Artifact [00ce035b14]:


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <stdlib.h>

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

#import "autorelease.h"
#import "common.h"

@implementation OFHTTPRequestFailedException
+ (instancetype)exceptionWithClass: (Class)class
			   request: (OFHTTPRequest*)request
			     reply: (OFHTTPRequestReply*)reply
{







<







19
20
21
22
23
24
25

26
27
28
29
30
31
32
#include <stdlib.h>

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


#import "common.h"

@implementation OFHTTPRequestFailedException
+ (instancetype)exceptionWithClass: (Class)class
			   request: (OFHTTPRequest*)request
			     reply: (OFHTTPRequestReply*)reply
{
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
99
100
101
102
103
104
105
106
107
108
109
110
111
	[_reply release];

	[super dealloc];
}

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

	if (_description != nil)
		return _description;

	switch ([_request 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, [_request URL], [_reply statusCode]];

	objc_autoreleasePoolPop(pool);

	return _description;
}

- (OFHTTPRequest*)request
{
	OF_GETTER(_request, NO)
}

- (OFHTTPRequestReply*)reply
{
	OF_GETTER(_reply, NO)
}
@end







<


<
<
<












<
|
<


<
<
<
<












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
99
100
	[_reply release];

	[super dealloc];
}

- (OFString*)description
{

	const char *type = "(unknown)";




	switch ([_request 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;
	}


	return [OFString stringWithFormat:

	    @"A HTTP %s request in class %@ with URL %@ failed with code %d",
	    type, _inClass, [_request URL], [_reply statusCode]];




}

- (OFHTTPRequest*)request
{
	OF_GETTER(_request, NO)
}

- (OFHTTPRequestReply*)reply
{
	OF_GETTER(_reply, NO)
}
@end