Skip to content

Commit

Permalink
NSDistributedNotificationCenter: Throw a descriptive exception when g…
Browse files Browse the repository at this point in the history
…dnc could not be found

`NSTask launchPathForTool: @"gdnc"];` can return `nil` when the tool is not found.  In this case, `[NSTask launchedTaskWithLaunchPath]` would raise a `NSInvalidArgumentException` with error message "NSTask - no launch path set" which is not very descriptive.
  • Loading branch information
qmfrederik committed Oct 11, 2023
1 parent bf586ec commit b9f3bb4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Source/NSDistributedNotificationCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,12 @@ - (void) _connect

cmd = [NSTask launchPathForTool: @"gdnc"];

if (cmd == nil)
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to find the gdnc tool.\n"];
}

NSDebugMLLog(@"NSDistributedNotificationCenter",
@"\nI couldn't contact the notification server for %@ -\n"
@"so I'm attempting to to start one - which will take a few seconds.\n"
Expand Down

0 comments on commit b9f3bb4

Please sign in to comment.