throw a catchable exception in getUser()
This commit is contained in:
parent
b1802b8720
commit
ab24007f4c
@ -178,6 +178,10 @@ function get_option_value($opt, $alt=null)
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class NoUserArgumentException extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
function getUser()
|
function getUser()
|
||||||
{
|
{
|
||||||
$user = null;
|
$user = null;
|
||||||
@ -195,8 +199,7 @@ function getUser()
|
|||||||
throw new Exception("Can't find user with nickname '$nickname'");
|
throw new Exception("Can't find user with nickname '$nickname'");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
show_help();
|
throw new NoUserArgumentException("No user argument specified.");
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $user;
|
return $user;
|
||||||
|
Loading…
Reference in New Issue
Block a user