Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96617638
PhabricatorRateLimitRequestExceptionHandler.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 29, 00:12
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 31, 00:12 (1 d, 7 h)
Engine
blob
Format
Raw Data
Handle
23216443
Attached To
rPH Phabricator
PhabricatorRateLimitRequestExceptionHandler.php
View Options
<?php
final
class
PhabricatorRateLimitRequestExceptionHandler
extends
PhabricatorRequestExceptionHandler
{
public
function
getRequestExceptionHandlerPriority
()
{
return
300000
;
}
public
function
getRequestExceptionHandlerDescription
()
{
return
pht
(
'Handles action rate limiting exceptions which occur when a user '
.
'does something too frequently.'
);
}
public
function
canHandleRequestThrowable
(
AphrontRequest
$request
,
$throwable
)
{
if
(!
$this
->
isPhabricatorSite
(
$request
))
{
return
false
;
}
return
(
$throwable
instanceof
PhabricatorSystemActionRateLimitException
);
}
public
function
handleRequestThrowable
(
AphrontRequest
$request
,
$throwable
)
{
$viewer
=
$this
->
getViewer
(
$request
);
return
id
(
new
AphrontDialogView
())
->
setTitle
(
pht
(
'Slow Down!'
))
->
setUser
(
$viewer
)
->
setErrors
(
array
(
pht
(
'You are being rate limited.'
)))
->
appendParagraph
(
$throwable
->
getMessage
())
->
appendParagraph
(
$throwable
->
getRateExplanation
())
->
addCancelButton
(
'/'
,
pht
(
'Okaaaaaaaaaaaaaay...'
));
}
}
Event Timeline
Log In to Comment