Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/aphront/handler/PhabricatorAjaxRequestExceptionHandler.php
12241 views
1
<?php
2
3
final class PhabricatorAjaxRequestExceptionHandler
4
extends PhabricatorRequestExceptionHandler {
5
6
public function getRequestExceptionHandlerPriority() {
7
return 110000;
8
}
9
10
public function getRequestExceptionHandlerDescription() {
11
return pht('Responds to requests made by AJAX clients.');
12
}
13
14
public function canHandleRequestThrowable(
15
AphrontRequest $request,
16
$throwable) {
17
// For non-workflow requests, return a Ajax response.
18
return ($request->isAjax() && !$request->isWorkflow());
19
}
20
21
public function handleRequestThrowable(
22
AphrontRequest $request,
23
$throwable) {
24
25
// Log these; they don't get shown on the client and can be difficult
26
// to debug.
27
phlog($throwable);
28
29
$response = new AphrontAjaxResponse();
30
$response->setError(
31
array(
32
'code' => get_class($throwable),
33
'info' => $throwable->getMessage(),
34
));
35
36
return $response;
37
}
38
39
}
40
41