mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-01 17:38:24 +01:00
36e2d02d6e
Summary: `pht`ize a whole bunch of strings in rP. Test Plan: Intense eyeballing. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: hach-que, Korvin, epriestley Differential Revision: https://secure.phabricator.com/D12797
35 lines
1 KiB
PHP
35 lines
1 KiB
PHP
<?php
|
|
|
|
final class PhabricatorDataNotAttachedException extends Exception {
|
|
|
|
public function __construct($object) {
|
|
$stack = debug_backtrace();
|
|
|
|
// Shift off `PhabricatorDataNotAttachedException::__construct()`.
|
|
array_shift($stack);
|
|
// Shift off `PhabricatorLiskDAO::assertAttached()`.
|
|
array_shift($stack);
|
|
|
|
$frame = head($stack);
|
|
$via = null;
|
|
if (is_array($frame)) {
|
|
$method = idx($frame, 'function');
|
|
if (preg_match('/^get[A-Z]/', $method)) {
|
|
$via = ' '.pht('(via %s)', "{$method}()");
|
|
}
|
|
}
|
|
|
|
parent::__construct(
|
|
pht(
|
|
"Attempting to access attached data on %s, but the data is not ".
|
|
"actually attached. Before accessing attachable data on an object, ".
|
|
"you must load and attach it.\n\n".
|
|
"Data is normally attached by calling the corresponding %s method on ".
|
|
"the Query class when the object is loaded. You can also call the ".
|
|
"corresponding %s method explicitly.",
|
|
get_class($object).$via,
|
|
'needX()',
|
|
'attachX()'));
|
|
}
|
|
|
|
}
|