Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/aphront/handler/PhabricatorConduitRequestExceptionHandler.php
12241 views
1
<?php
2
3
final class PhabricatorConduitRequestExceptionHandler
4
extends PhabricatorRequestExceptionHandler {
5
6
public function getRequestExceptionHandlerPriority() {
7
return 100000;
8
}
9
10
public function getRequestExceptionHandlerDescription() {
11
return pht('Responds to requests made by Conduit clients.');
12
}
13
14
public function canHandleRequestThrowable(
15
AphrontRequest $request,
16
$throwable) {
17
return $request->isConduit();
18
}
19
20
public function handleRequestThrowable(
21
AphrontRequest $request,
22
$throwable) {
23
24
$response = id(new ConduitAPIResponse())
25
->setErrorCode(get_class($throwable))
26
->setErrorInfo($throwable->getMessage());
27
28
return id(new AphrontJSONResponse())
29
->setAddJSONShield(false)
30
->setContent($response->toDictionary());
31
}
32
33
}
34
35