Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93121014
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
Tue, Nov 26, 08:54
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Nov 28, 08:54 (2 d)
Engine
blob
Format
Raw Data
Handle
22547964
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