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
This commit is contained in:
Richard Frith-Macdonald 2002-10-04 10:37:04 +00:00
parent 326694568f
commit 96fcbc6c77
3 changed files with 25 additions and 4 deletions

View file

@ -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 <fedor@gnu.org>

View file

@ -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;
}

View file

@ -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
{