ObjFW  Check-in [6b22a15485]

Overview
Comment:Allow OFAddressTranslationFailedExceptions without service and node.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6b22a154855ed462fa92e4c6948d5a75c3a38a6c6b1521de4ae8f0ec97f47f3e
User & Date: js on 2010-04-11 17:16:39
Other Links: manifest | tags
Context
2010-04-11
17:43
Don't require OFCopying protocol for the thread's object. check-in: e5240d68e8 user: js tags: trunk
17:16
Allow OFAddressTranslationFailedExceptions without service and node. check-in: 6b22a15485 user: js tags: trunk
16:37
Fix manually closing a TCP socket and improve automatic closing. check-in: cecf1d4bf7 user: js tags: trunk
Changes

Modified src/OFExceptions.m from [67a9a0c742] to [ad317396bc].

29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44

45
46
47
48
49
50
51
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51







-
+







-
+







#import "OFExceptions.h"
#import "OFString.h"
#import "OFTCPSocket.h"

#ifndef _WIN32
# include <errno.h>
# define GET_ERR	errno
# ifndef HAVE_GETADDRINFO
# ifndef HAVE_THREADSAFE_GETADDRINFO
#  define GET_AT_ERR	h_errno
# else
#  define GET_AT_ERR	errno
# endif
# define GET_SOCK_ERR	errno
# define ERRFMT		"Error string was: %s"
# define ERRPARAM	strerror(err)
# ifndef HAVE_GETADDRINFO
# ifndef HAVE_THREADSAFE_GETADDRINFO
#  define AT_ERRPARAM	hstrerror(err)
# else
#  define AT_ERRPARAM	strerror(err)
# endif
#else
# include <windows.h>
# define GET_ERR	GetLastError()
956
957
958
959
960
961
962

963
964




965
966
967
968
969
970
971
956
957
958
959
960
961
962
963


964
965
966
967
968
969
970
971
972
973
974







+
-
-
+
+
+
+







	return [[self alloc] initWithClass: class__
				      node: node_
				   service: service_];
}

- initWithClass: (Class)class__
{
	self = [super initWithClass: class__];
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];

	err = GET_AT_ERR;

	return self;
}

- initWithClass: (Class)class__
	   node: (OFString*)node_
	service: (OFString*)service_
{
	self = [super initWithClass: class__];
986
987
988
989
990
991
992

993
994
995
996
997
998
999












1000
1001
1002
1003
1004
1005
1006
989
990
991
992
993
994
995
996







997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015







+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+







}

- (OFString*)string
{
	if (string != nil)
		return string;

	if (node != nil && service != nil)
	string = [[OFString alloc] initWithFormat:
	    @"The service %s on %s could not be translated to an address in "
	    @"class %s. This means that either the node was not found, there "
	    @"is no such service on the node, there was a problem with the "
	    @"name server, there was a problem with your network connection "
	    @"or you specified an invalid node or service. " ERRFMT,
	    [service cString], [node cString], [class_ className], AT_ERRPARAM];
		string = [[OFString alloc] initWithFormat:
		    @"The service %s on %s could not be translated to an "
		    @"address in class %s. This means that either the node was "
		    @"not found, there is no such service on the node, there "
		    @"was a problem with the name server, there was a problem "
		    @"with your network connection or you specified an invalid "
		    @"node or service. " ERRFMT, [service cString],
		    [node cString], [class_ className], AT_ERRPARAM];
	else
		string = [[OFString alloc] initWithFormat:
		    @"An address translation failed in class %s! " ERRFMT,
		    [class_ className], AT_ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;