Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93907361
AphrontUnhandledExceptionResponse.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
Mon, Dec 2, 10:25
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 4, 10:25 (2 d)
Engine
blob
Format
Raw Data
Handle
22722607
Attached To
rPH Phabricator
AphrontUnhandledExceptionResponse.php
View Options
<?php
final
class
AphrontUnhandledExceptionResponse
extends
AphrontStandaloneHTMLResponse
{
private
$exception
;
public
function
setException
(
Exception
$exception
)
{
// Log the exception unless it's specifically a silent malformed request
// exception.
$should_log
=
true
;
if
(
$exception
instanceof
AphrontMalformedRequestException
)
{
if
(
$exception
->
getIsUnlogged
())
{
$should_log
=
false
;
}
}
if
(
$should_log
)
{
phlog
(
$exception
);
}
$this
->
exception
=
$exception
;
return
$this
;
}
public
function
getHTTPResponseCode
()
{
return
500
;
}
protected
function
getResources
()
{
return
array
(
'css/application/config/config-template.css'
,
'css/application/config/unhandled-exception.css'
,
);
}
protected
function
getResponseTitle
()
{
$ex
=
$this
->
exception
;
if
(
$ex
instanceof
AphrontMalformedRequestException
)
{
return
$ex
->
getTitle
();
}
else
{
return
pht
(
'Unhandled Exception'
);
}
}
protected
function
getResponseBodyClass
()
{
return
'unhandled-exception'
;
}
protected
function
getResponseBody
()
{
$ex
=
$this
->
exception
;
if
(
$ex
instanceof
AphrontMalformedRequestException
)
{
$title
=
$ex
->
getTitle
();
}
else
{
$title
=
get_class
(
$ex
);
}
$body
=
$ex
->
getMessage
();
$body
=
phutil_escape_html_newlines
(
$body
);
return
phutil_tag
(
'div'
,
array
(
'class'
=>
'unhandled-exception-detail'
,
),
array
(
phutil_tag
(
'h1'
,
array
(
'class'
=>
'unhandled-exception-title'
,
),
$title
),
phutil_tag
(
'div'
,
array
(
'class'
=>
'unhandled-exception-body'
,
),
$body
),
));
}
protected
function
buildPlainTextResponseString
()
{
$ex
=
$this
->
exception
;
return
pht
(
'%s: %s'
,
get_class
(
$ex
),
$ex
->
getMessage
());
}
}
Event Timeline
Log In to Comment