Changeset View
Changeset View
Standalone View
Standalone View
src/future/exec/CommandException.php
Show First 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | if (!strlen($string)) { | ||||
return '(empty)'; | return '(empty)'; | ||||
} | } | ||||
$limit = 1000; | $limit = 1000; | ||||
$len = strlen($string); | $len = strlen($string); | ||||
if ($len > $limit) { | if ($len > $limit) { | ||||
$cut = $len - $limit; | $cut = $len - $limit; | ||||
$suffix = pht('... (%s more bytes) ...', new PhutilNumber($cut)); | $suffix = pht('... (%s more byte(s)) ...', new PhutilNumber($cut)); | ||||
if ($cut > strlen($suffix)) { | if ($cut > strlen($suffix)) { | ||||
$string = substr($string, 0, $limit).$suffix; | $string = substr($string, 0, $limit).$suffix; | ||||
} | } | ||||
} | } | ||||
// Strip out any credentials for the purpose of building a human readable | // Strip out any credentials for the purpose of building a human readable | ||||
// summary of the exception, since these are rarely-if-ever useful when | // summary of the exception, since these are rarely-if-ever useful when | ||||
// debugging, but can expose otherwise sensitive information. | // debugging, but can expose otherwise sensitive information. | ||||
$string = phutil_censor_credentials($string); | $string = phutil_censor_credentials($string); | ||||
return $string; | return $string; | ||||
} | } | ||||
} | } |