Path: blob/master/src/aphront/handler/PhabricatorRateLimitRequestExceptionHandler.php
12241 views
<?php12final class PhabricatorRateLimitRequestExceptionHandler3extends PhabricatorRequestExceptionHandler {45public function getRequestExceptionHandlerPriority() {6return 300000;7}89public function getRequestExceptionHandlerDescription() {10return pht(11'Handles action rate limiting exceptions which occur when a user '.12'does something too frequently.');13}1415public function canHandleRequestThrowable(16AphrontRequest $request,17$throwable) {1819if (!$this->isPhabricatorSite($request)) {20return false;21}2223return ($throwable instanceof PhabricatorSystemActionRateLimitException);24}2526public function handleRequestThrowable(27AphrontRequest $request,28$throwable) {2930$viewer = $this->getViewer($request);3132return id(new AphrontDialogView())33->setTitle(pht('Slow Down!'))34->setUser($viewer)35->setErrors(array(pht('You are being rate limited.')))36->appendParagraph($throwable->getMessage())37->appendParagraph($throwable->getRateExplanation())38->addCancelButton('/', pht('Okaaaaaaaaaaaaaay...'));39}4041}424344