handle tracker check user exception

This commit is contained in:
xiaomlove
2022-04-07 01:16:17 +08:00
parent e093b91133
commit 25a4cdfafc

View File

@@ -298,7 +298,11 @@ class TrackerRepository extends BaseRepository
if (!$user) {
throw new TrackerException("Invalid user $field: $value.");
}
$user->checkIsNormal();
try {
$user->checkIsNormal();
} catch (\Throwable $exception) {
throw new TrackerException($exception->getMessage());
}
if ($user->parked == 'yes') {
throw new TrackerException("Your account is parked! (Read the FAQ)");
@@ -829,8 +833,8 @@ class TrackerRepository extends BaseRepository
throw new TrackerException("key: info_hash is Missing !");
} else {
foreach ($info_hash_array as $item) {
if (strlen($item) != 20) {
throw new TrackerException("Invalid info_hash ! info_hash is not 20 bytes long");
if (($length = strlen($item)) != 20) {
throw new TrackerException("Invalid info_hash ! info_hash is not 20 bytes long($length)");
}
}
}