Page MenuHomePhabricator

D9992.id24035.diff
No OneTemporary

D9992.id24035.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -216,6 +216,7 @@
'PhutilLunarPhaseTestCase' => 'utils/__tests__/PhutilLunarPhaseTestCase.php',
'PhutilMarkupEngine' => 'markup/PhutilMarkupEngine.php',
'PhutilMarkupTestCase' => 'markup/__tests__/PhutilMarkupTestCase.php',
+ 'PhutilMethodNotImplementedException' => 'error/PhutilMethodNotImplementedException.php',
'PhutilMetricsChannel' => 'channel/PhutilMetricsChannel.php',
'PhutilMissingSymbolException' => 'symbols/exception/PhutilMissingSymbolException.php',
'PhutilModuleUtilsTestCase' => 'moduleutils/__tests__/PhutilModuleUtilsTestCase.php',
@@ -623,6 +624,7 @@
'PhutilLogfileChannel' => 'PhutilChannelChannel',
'PhutilLunarPhaseTestCase' => 'PhutilTestCase',
'PhutilMarkupTestCase' => 'PhutilTestCase',
+ 'PhutilMethodNotImplementedException' => 'Exception',
'PhutilMetricsChannel' => 'PhutilChannelChannel',
'PhutilMissingSymbolException' => 'Exception',
'PhutilModuleUtilsTestCase' => 'PhutilTestCase',
diff --git a/src/error/PhutilMethodNotImplementedException.php b/src/error/PhutilMethodNotImplementedException.php
new file mode 100644
--- /dev/null
+++ b/src/error/PhutilMethodNotImplementedException.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * An exception thrown when a method is called on a class which does not
+ * provide an implementation for the called method. This is sometimes the case
+ * when a base class expects subclasses to provide their own implementations,
+ * for example.
+ */
+final class PhutilMethodNotImplementedException extends Exception {
+
+ public function __construct($message = null) {
+ if ($message) {
+ parent::__construct($message);
+ } else {
+ $caller = idx(debug_backtrace(false), 1);
+
+ $class = idx($caller, 'class');
+ $function = idx($caller, 'function');
+
+ if ($class) {
+ parent::__construct(
+ pht('Method %s in class %s is not implemented!', $function, $class));
+ } else {
+ parent::__construct(pht('Function %s is not implemented!', $function));
+ }
+ }
+ }
+
+}
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineBlockRule.php
@@ -88,7 +88,7 @@
}
public function extractChildText($text) {
- throw new Exception(pht('Not implemented!'));
+ throw new PhutilMethodNotImplementedException();
}
protected function renderRemarkupTable(array $out_rows) {

File Metadata

Mime Type
text/plain
Expires
Wed, May 15, 12:36 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6295766
Default Alt Text
D9992.id24035.diff (2 KB)

Event Timeline