squelch another prefinery error

This commit is contained in:
Alex Grintsvayg 2017-03-21 19:26:40 -04:00
parent fafc5c32ad
commit f0232af01a
2 changed files with 21 additions and 3 deletions

View file

@ -180,11 +180,18 @@ class DownloadActions extends Actions
$prefineryUser = Prefinery::findUser($userId);
preg_match('/\?r\=(\w+)/', $prefineryUser['share_link'], $matches);
if ($prefineryUser)
{
preg_match('/\?r\=(\w+)/', $prefineryUser['share_link'], $matches);
}
else
{
$matches = null;
}
return $vars + [
'prefineryUser' => $prefineryUser,
'referralCode' => $matches[1] ?: 'unknown'
'referralCode' => $matches[1] ?? 'unknown'
];
}

View file

@ -33,7 +33,18 @@ class Prefinery
}
}
$user = is_numeric($emailOrId) ? Prefinery::findTesterById($emailOrId) : Prefinery::findTesterByEmail($emailOrId);
try
{
$user = is_numeric($emailOrId) ? Prefinery::findTesterById($emailOrId) : Prefinery::findTesterByEmail($emailOrId);
}
catch (PrefineryException $e)
{
if (stripos($e->getMessage(), 'Tester is hidden.') === false)
{
throw $e;
}
}
if ($user)
{
unset($user['invitation_code']); // so we dont leak it