rate limit things

This commit is contained in:
Andras Bacsai
2023-08-15 14:27:45 +02:00
parent 88b3005589
commit f8d7c5209e
11 changed files with 90 additions and 9 deletions

View File

@@ -8,6 +8,7 @@ use Illuminate\Support\Str;
use Nubs\RandomNameGenerator\All;
use Poliander\Cron\CronExpression;
use Visus\Cuid2\Cuid2;
use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
function application_configuration_dir(): string
{
@@ -46,7 +47,9 @@ function general_error_handler(Throwable|null $err = null, $that = null, $isJson
} else {
throw new Exception($customErrorMessage ?? $err->errorInfo[2]);
}
} else {
} elseif($err instanceof TooManyRequestsException){
throw new Exception($customErrorMessage ?? "Too many requests. Please try again in {$err->secondsUntilAvailable} seconds.");
}else {
throw new Exception($customErrorMessage ?? $err->getMessage());
}
} catch (Throwable $error) {