From 96fcbc6c77c3165d5cdfdc8a5943438e8abb374f Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Fri, 4 Oct 2002 10:37:04 +0000 Subject: [PATCH] Add lots of detail to exception on port registration failure. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14640 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 2 ++ Source/GSTcpPort.m | 14 +++++++++++--- Source/NSPortNameServer.m | 13 ++++++++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b41809806..6cf8ad996 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ adding lots of logging information. Also documented quite a bit. Resolved all conflicts found with Adam's change ... generally in favor of the most informative logging. + * Source/NSPortNameServer.m: On failure to register name, make + exception message provide lots of detail/advice for newbies. 2002-10-03 Adam Fedor diff --git a/Source/GSTcpPort.m b/Source/GSTcpPort.m index 2f8223cbd..b57fbec27 100644 --- a/Source/GSTcpPort.m +++ b/Source/GSTcpPort.m @@ -1644,9 +1644,17 @@ static Class tcpPortClass; { NSMutableString *desc; - desc = [NSMutableString stringWithFormat: @"Host - %@\n", host]; - [desc appendFormat: @"Addr - %@\n", address]; - [desc appendFormat: @"Port - %d\n", portNum]; + desc = [NSMutableString stringWithFormat: @"NSPort on host with details -\n" + @"%@\n", host]; + if (address == nil) + { + [desc appendFormat: @" IP address - any\n"]; + } + else + { + [desc appendFormat: @" IP address - %@\n", address]; + } + [desc appendFormat: @" TCP port - %d\n", portNum]; return desc; } diff --git a/Source/NSPortNameServer.m b/Source/NSPortNameServer.m index b121ae498..2202df84c 100644 --- a/Source/NSPortNameServer.m +++ b/Source/NSPortNameServer.m @@ -915,7 +915,18 @@ typedef enum { if (result == 0) { [NSException raise: NSGenericException - format: @"unable to register %@", name]; + format: @"Unable to register name '%@' for the port -\n%@\n" +@"Typically, this might mean that a process is already running with the name\n" +@"'%@' ...\n" +@"Try the command -\n" +@" gdomap -L '%@'\n" +@"to find its network details.\n" +@"Alternatively, it may have been shut down without unregistering, and\n" +@"another process may be running using the same network port. If this is\n" +@"the case, you can use -\n" +@"gdomap -U '%@'\n" +@"to remove the registration so that you can attempt this operation again.", + name, port, name, name, name]; } else {