5a7d3a280aa71eb45767fe24c040fb2cb2b8f6fb
[lhc/web/wiklou.git] / includes / api / ApiMain.php
1 <?php
2
3 /*
4 * Created on Sep 4, 2006
5 *
6 * API for MediaWiki 1.8+
7 *
8 * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 * http://www.gnu.org/copyleft/gpl.html
24 */
25
26 if (!defined('MEDIAWIKI')) {
27 // Eclipse helper - will be ignored in production
28 require_once ('ApiBase.php');
29 }
30
31 /**
32 * @defgroup API API
33 */
34
35 /**
36 * This is the main API class, used for both external and internal processing.
37 * When executed, it will create the requested formatter object,
38 * instantiate and execute an object associated with the needed action,
39 * and use formatter to print results.
40 * In case of an exception, an error message will be printed using the same formatter.
41 *
42 * To use API from another application, run it using FauxRequest object, in which
43 * case any internal exceptions will not be handled but passed up to the caller.
44 * After successful execution, use getResult() for the resulting data.
45 *
46 * @ingroup API
47 */
48 class ApiMain extends ApiBase {
49
50 /**
51 * When no format parameter is given, this format will be used
52 */
53 const API_DEFAULT_FORMAT = 'xmlfm';
54
55 /**
56 * List of available modules: action name => module class
57 */
58 private static $Modules = array (
59 'login' => 'ApiLogin',
60 'logout' => 'ApiLogout',
61 'query' => 'ApiQuery',
62 'expandtemplates' => 'ApiExpandTemplates',
63 'parse' => 'ApiParse',
64 'opensearch' => 'ApiOpenSearch',
65 'feedwatchlist' => 'ApiFeedWatchlist',
66 'help' => 'ApiHelp',
67 'paraminfo' => 'ApiParamInfo',
68
69 // Write modules
70 'purge' => 'ApiPurge',
71 'rollback' => 'ApiRollback',
72 'delete' => 'ApiDelete',
73 'undelete' => 'ApiUndelete',
74 'protect' => 'ApiProtect',
75 'block' => 'ApiBlock',
76 'unblock' => 'ApiUnblock',
77 'move' => 'ApiMove',
78 'edit' => 'ApiEditPage',
79 'emailuser' => 'ApiEmailUser',
80 'watch' => 'ApiWatch',
81 'patrol' => 'ApiPatrol',
82 'import' => 'ApiImport',
83 'userrights' => 'ApiUserrights',
84 );
85
86 /**
87 * List of available formats: format name => format class
88 */
89 private static $Formats = array (
90 'json' => 'ApiFormatJson',
91 'jsonfm' => 'ApiFormatJson',
92 'php' => 'ApiFormatPhp',
93 'phpfm' => 'ApiFormatPhp',
94 'wddx' => 'ApiFormatWddx',
95 'wddxfm' => 'ApiFormatWddx',
96 'xml' => 'ApiFormatXml',
97 'xmlfm' => 'ApiFormatXml',
98 'yaml' => 'ApiFormatYaml',
99 'yamlfm' => 'ApiFormatYaml',
100 'rawfm' => 'ApiFormatJson',
101 'txt' => 'ApiFormatTxt',
102 'txtfm' => 'ApiFormatTxt',
103 'dbg' => 'ApiFormatDbg',
104 'dbgfm' => 'ApiFormatDbg'
105 );
106
107 /**
108 * List of user roles that are specifically relevant to the API.
109 * array( 'right' => array ( 'msg' => 'Some message with a $1',
110 * 'params' => array ( $someVarToSubst ) ),
111 * );
112 */
113 private static $mRights = array('writeapi' => array(
114 'msg' => 'Use of the write API',
115 'params' => array()
116 ),
117 'apihighlimits' => array(
118 'msg' => 'Use higher limits in API queries (Slow queries: $1 results; Fast queries: $2 results). The limits for slow queries also apply to multivalue parameters.',
119 'params' => array (ApiMain::LIMIT_SML2, ApiMain::LIMIT_BIG2)
120 )
121 );
122
123
124 private $mPrinter, $mModules, $mModuleNames, $mFormats, $mFormatNames;
125 private $mResult, $mAction, $mShowVersions, $mEnableWrite, $mRequest, $mInternalMode, $mSquidMaxage;
126
127 /**
128 * Constructs an instance of ApiMain that utilizes the module and format specified by $request.
129 *
130 * @param $request object - if this is an instance of FauxRequest, errors are thrown and no printing occurs
131 * @param $enableWrite bool should be set to true if the api may modify data
132 */
133 public function __construct($request, $enableWrite = false) {
134
135 $this->mInternalMode = ($request instanceof FauxRequest);
136
137 // Special handling for the main module: $parent === $this
138 parent :: __construct($this, $this->mInternalMode ? 'main_int' : 'main');
139
140 if (!$this->mInternalMode) {
141
142 // Impose module restrictions.
143 // If the current user cannot read,
144 // Remove all modules other than login
145 global $wgUser;
146
147 if( $request->getVal( 'callback' ) !== null ) {
148 // JSON callback allows cross-site reads.
149 // For safety, strip user credentials.
150 wfDebug( "API: stripping user credentials for JSON callback\n" );
151 $wgUser = new User();
152 }
153 }
154
155 global $wgAPIModules; // extension modules
156 $this->mModules = $wgAPIModules + self :: $Modules;
157
158 $this->mModuleNames = array_keys($this->mModules);
159 $this->mFormats = self :: $Formats;
160 $this->mFormatNames = array_keys($this->mFormats);
161
162 $this->mResult = new ApiResult($this);
163 $this->mShowVersions = false;
164 $this->mEnableWrite = $enableWrite;
165
166 $this->mRequest = & $request;
167
168 $this->mSquidMaxage = -1; // flag for executeActionWithErrorHandling()
169 $this->mCommit = false;
170 }
171
172 /**
173 * Return true if the API was started by other PHP code using FauxRequest
174 */
175 public function isInternalMode() {
176 return $this->mInternalMode;
177 }
178
179 /**
180 * Return the request object that contains client's request
181 */
182 public function getRequest() {
183 return $this->mRequest;
184 }
185
186 /**
187 * Get the ApiResult object asscosiated with current request
188 */
189 public function getResult() {
190 return $this->mResult;
191 }
192
193 /**
194 * Only kept for backwards compatibility
195 * @deprecated Use isWriteMode() instead
196 */
197 public function requestWriteMode() {}
198
199 /**
200 * Set how long the response should be cached.
201 */
202 public function setCacheMaxAge($maxage) {
203 $this->mSquidMaxage = $maxage;
204 }
205
206 /**
207 * Create an instance of an output formatter by its name
208 */
209 public function createPrinterByName($format) {
210 if( !isset( $this->mFormats[$format] ) )
211 $this->dieUsage( "Unrecognized format: {$format}", 'unknown_format' );
212 return new $this->mFormats[$format] ($this, $format);
213 }
214
215 /**
216 * Execute api request. Any errors will be handled if the API was called by the remote client.
217 */
218 public function execute() {
219 $this->profileIn();
220 if ($this->mInternalMode)
221 $this->executeAction();
222 else
223 $this->executeActionWithErrorHandling();
224
225 $this->profileOut();
226 }
227
228 /**
229 * Execute an action, and in case of an error, erase whatever partial results
230 * have been accumulated, and replace it with an error message and a help screen.
231 */
232 protected function executeActionWithErrorHandling() {
233
234 // In case an error occurs during data output,
235 // clear the output buffer and print just the error information
236 ob_start();
237
238 try {
239 $this->executeAction();
240 } catch (Exception $e) {
241 // Log it
242 if ( $e instanceof MWException ) {
243 wfDebugLog( 'exception', $e->getLogMessage() );
244 }
245
246 //
247 // Handle any kind of exception by outputing properly formatted error message.
248 // If this fails, an unhandled exception should be thrown so that global error
249 // handler will process and log it.
250 //
251
252 $errCode = $this->substituteResultWithError($e);
253
254 // Error results should not be cached
255 $this->setCacheMaxAge(0);
256
257 $headerStr = 'MediaWiki-API-Error: ' . $errCode;
258 if ($e->getCode() === 0)
259 header($headerStr);
260 else
261 header($headerStr, true, $e->getCode());
262
263 // Reset and print just the error message
264 ob_clean();
265
266 // If the error occured during printing, do a printer->profileOut()
267 $this->mPrinter->safeProfileOut();
268 $this->printResult(true);
269 }
270
271 if($this->mSquidMaxage == -1)
272 {
273 # Nobody called setCacheMaxAge(), use the (s)maxage parameters
274 $smaxage = $this->getParameter('smaxage');
275 $maxage = $this->getParameter('maxage');
276 }
277 else
278 $smaxage = $maxage = $this->mSquidMaxage;
279
280 // Set the cache expiration at the last moment, as any errors may change the expiration.
281 // if $this->mSquidMaxage == 0, the expiry time is set to the first second of unix epoch
282 $exp = min($smaxage, $maxage);
283 $expires = ($exp == 0 ? 1 : time() + $exp);
284 header('Expires: ' . wfTimestamp(TS_RFC2822, $expires));
285 header('Cache-Control: s-maxage=' . $smaxage . ', must-revalidate, max-age=' . $maxage);
286
287 if($this->mPrinter->getIsHtml())
288 echo wfReportTime();
289
290 ob_end_flush();
291 }
292
293 /**
294 * Replace the result data with the information about an exception.
295 * Returns the error code
296 */
297 protected function substituteResultWithError($e) {
298
299 // Printer may not be initialized if the extractRequestParams() fails for the main module
300 if (!isset ($this->mPrinter)) {
301 // The printer has not been created yet. Try to manually get formatter value.
302 $value = $this->getRequest()->getVal('format', self::API_DEFAULT_FORMAT);
303 if (!in_array($value, $this->mFormatNames))
304 $value = self::API_DEFAULT_FORMAT;
305
306 $this->mPrinter = $this->createPrinterByName($value);
307 if ($this->mPrinter->getNeedsRawData())
308 $this->getResult()->setRawMode();
309 }
310
311 if ($e instanceof UsageException) {
312 //
313 // User entered incorrect parameters - print usage screen
314 //
315 $errMessage = $e->getMessageArray();
316
317 // Only print the help message when this is for the developer, not runtime
318 if ($this->mPrinter->getWantsHelp() || $this->mAction == 'help')
319 ApiResult :: setContent($errMessage, $this->makeHelpMsg());
320
321 } else {
322 global $wgShowSQLErrors, $wgShowExceptionDetails;
323 //
324 // Something is seriously wrong
325 //
326 if ( ( $e instanceof DBQueryError ) && !$wgShowSQLErrors ) {
327 $info = "Database query error";
328 } else {
329 $info = "Exception Caught: {$e->getMessage()}";
330 }
331
332 $errMessage = array (
333 'code' => 'internal_api_error_'. get_class($e),
334 'info' => $info,
335 );
336 ApiResult :: setContent($errMessage, $wgShowExceptionDetails ? "\n\n{$e->getTraceAsString()}\n\n" : "" );
337 }
338
339 $this->getResult()->reset();
340 $this->getResult()->disableSizeCheck();
341 // Re-add the id
342 $requestid = $this->getParameter('requestid');
343 if(!is_null($requestid))
344 $this->getResult()->addValue(null, 'requestid', $requestid);
345 $this->getResult()->addValue(null, 'error', $errMessage);
346
347 return $errMessage['code'];
348 }
349
350 /**
351 * Execute the actual module, without any error handling
352 */
353 protected function executeAction() {
354 // First add the id to the top element
355 $requestid = $this->getParameter('requestid');
356 if(!is_null($requestid))
357 $this->getResult()->addValue(null, 'requestid', $requestid);
358
359 $params = $this->extractRequestParams();
360
361 $this->mShowVersions = $params['version'];
362 $this->mAction = $params['action'];
363
364 if( !is_string( $this->mAction ) ) {
365 $this->dieUsage( "The API requires a valid action parameter", 'unknown_action' );
366 }
367
368 // Instantiate the module requested by the user
369 $module = new $this->mModules[$this->mAction] ($this, $this->mAction);
370
371 if( $module->shouldCheckMaxlag() && isset( $params['maxlag'] ) ) {
372 // Check for maxlag
373 global $wgShowHostnames;
374 $maxLag = $params['maxlag'];
375 list( $host, $lag ) = wfGetLB()->getMaxLag();
376 if ( $lag > $maxLag ) {
377 header( 'Retry-After: ' . max( intval( $maxLag ), 5 ) );
378 header( 'X-Database-Lag: ' . intval( $lag ) );
379 if( $wgShowHostnames ) {
380 $this->dieUsage( "Waiting for $host: $lag seconds lagged", 'maxlag', 503 );
381 } else {
382 $this->dieUsage( "Waiting for a database server: $lag seconds lagged", 'maxlag', 503 );
383 }
384 return;
385 }
386 }
387
388 global $wgUser;
389 if ($module->isReadMode() && !$wgUser->isAllowed('read'))
390 $this->dieUsageMsg(array('readrequired'));
391 if ($module->isWriteMode()) {
392 if (!$this->mEnableWrite)
393 $this->dieUsageMsg(array('writedisabled'));
394 if (!$wgUser->isAllowed('writeapi'))
395 $this->dieUsageMsg(array('writerequired'));
396 if (wfReadOnly())
397 $this->dieReadOnly();
398 }
399
400 if (!$this->mInternalMode) {
401 // Ignore mustBePosted() for internal calls
402 if($module->mustBePosted() && !$this->mRequest->wasPosted())
403 $this->dieUsage("The {$this->mAction} module requires a POST request", 'mustbeposted');
404
405 // See if custom printer is used
406 $this->mPrinter = $module->getCustomPrinter();
407 if (is_null($this->mPrinter)) {
408 // Create an appropriate printer
409 $this->mPrinter = $this->createPrinterByName($params['format']);
410 }
411
412 if ($this->mPrinter->getNeedsRawData())
413 $this->getResult()->setRawMode();
414 }
415
416 // Execute
417 $module->profileIn();
418 $module->execute();
419 wfRunHooks('APIAfterExecute', array(&$module));
420 $module->profileOut();
421
422 if (!$this->mInternalMode) {
423 // Print result data
424 $this->printResult(false);
425 }
426 }
427
428 /**
429 * Print results using the current printer
430 */
431 protected function printResult($isError) {
432 $this->getResult()->cleanUpUTF8();
433 $printer = $this->mPrinter;
434 $printer->profileIn();
435
436 /* If the help message is requested in the default (xmlfm) format,
437 * tell the printer not to escape ampersands so that our links do
438 * not break. */
439 $printer->setUnescapeAmps ( ( $this->mAction == 'help' || $isError )
440 && $printer->getFormat() == 'XML' && $printer->getIsHtml() );
441
442 $printer->initPrinter($isError);
443
444 $printer->execute();
445 $printer->closePrinter();
446 $printer->profileOut();
447 }
448
449 public function isReadMode() {
450 return false;
451 }
452
453 /**
454 * See ApiBase for description.
455 */
456 public function getAllowedParams() {
457 return array (
458 'format' => array (
459 ApiBase :: PARAM_DFLT => ApiMain :: API_DEFAULT_FORMAT,
460 ApiBase :: PARAM_TYPE => $this->mFormatNames
461 ),
462 'action' => array (
463 ApiBase :: PARAM_DFLT => 'help',
464 ApiBase :: PARAM_TYPE => $this->mModuleNames
465 ),
466 'version' => false,
467 'maxlag' => array (
468 ApiBase :: PARAM_TYPE => 'integer'
469 ),
470 'smaxage' => array (
471 ApiBase :: PARAM_TYPE => 'integer',
472 ApiBase :: PARAM_DFLT => 0
473 ),
474 'maxage' => array (
475 ApiBase :: PARAM_TYPE => 'integer',
476 ApiBase :: PARAM_DFLT => 0
477 ),
478 'requestid' => null,
479 );
480 }
481
482 /**
483 * See ApiBase for description.
484 */
485 public function getParamDescription() {
486 return array (
487 'format' => 'The format of the output',
488 'action' => 'What action you would like to perform',
489 'version' => 'When showing help, include version for each module',
490 'maxlag' => 'Maximum lag',
491 'smaxage' => 'Set the s-maxage header to this many seconds. Errors are never cached',
492 'maxage' => 'Set the max-age header to this many seconds. Errors are never cached',
493 'requestid' => 'Request ID to distinguish requests. This will just be output back to you',
494 );
495 }
496
497 /**
498 * See ApiBase for description.
499 */
500 public function getDescription() {
501 return array (
502 '',
503 '',
504 '******************************************************************',
505 '** **',
506 '** This is an auto-generated MediaWiki API documentation page **',
507 '** **',
508 '** Documentation and Examples: **',
509 '** http://www.mediawiki.org/wiki/API **',
510 '** **',
511 '******************************************************************',
512 '',
513 'Status: All features shown on this page should be working, but the API',
514 ' is still in active development, and may change at any time.',
515 ' Make sure to monitor our mailing list for any updates.',
516 '',
517 'Documentation: http://www.mediawiki.org/wiki/API',
518 'Mailing list: http://lists.wikimedia.org/mailman/listinfo/mediawiki-api',
519 'Bugs & Requests: http://bugzilla.wikimedia.org/buglist.cgi?component=API&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&order=bugs.delta_ts',
520 '',
521 '',
522 '',
523 '',
524 '',
525 );
526 }
527
528 /**
529 * Returns an array of strings with credits for the API
530 */
531 protected function getCredits() {
532 return array(
533 'API developers:',
534 ' Roan Kattouw <Firstname>.<Lastname>@home.nl (lead developer Sep 2007-present)',
535 ' Victor Vasiliev - vasilvv at gee mail dot com',
536 ' Bryan Tong Minh - bryan . tongminh @ gmail . com',
537 ' Yuri Astrakhan <Firstname><Lastname>@gmail.com (creator, lead developer Sep 2006-Sep 2007)',
538 '',
539 'Please send your comments, suggestions and questions to mediawiki-api@lists.wikimedia.org',
540 'or file a bug report at http://bugzilla.wikimedia.org/'
541 );
542 }
543
544 /**
545 * Override the parent to generate help messages for all available modules.
546 */
547 public function makeHelpMsg() {
548
549 $this->mPrinter->setHelp();
550
551 // Use parent to make default message for the main module
552 $msg = parent :: makeHelpMsg();
553
554 $astriks = str_repeat('*** ', 10);
555 $msg .= "\n\n$astriks Modules $astriks\n\n";
556 foreach( $this->mModules as $moduleName => $unused ) {
557 $module = new $this->mModules[$moduleName] ($this, $moduleName);
558 $msg .= self::makeHelpMsgHeader($module, 'action');
559 $msg2 = $module->makeHelpMsg();
560 if ($msg2 !== false)
561 $msg .= $msg2;
562 $msg .= "\n";
563 }
564
565 $msg .= "\n$astriks Permissions $astriks\n\n";
566 foreach ( self :: $mRights as $right => $rightMsg ) {
567 $groups = User::getGroupsWithPermission( $right );
568 $msg .= "* " . $right . " *\n " . wfMsgReplaceArgs( $rightMsg[ 'msg' ], $rightMsg[ 'params' ] ) .
569 "\nGranted to:\n " . str_replace( "*", "all", implode( ", ", $groups ) ) . "\n";
570
571 }
572
573 $msg .= "\n$astriks Formats $astriks\n\n";
574 foreach( $this->mFormats as $formatName => $unused ) {
575 $module = $this->createPrinterByName($formatName);
576 $msg .= self::makeHelpMsgHeader($module, 'format');
577 $msg2 = $module->makeHelpMsg();
578 if ($msg2 !== false)
579 $msg .= $msg2;
580 $msg .= "\n";
581 }
582
583 $msg .= "\n*** Credits: ***\n " . implode("\n ", $this->getCredits()) . "\n";
584
585
586 return $msg;
587 }
588
589 public static function makeHelpMsgHeader($module, $paramName) {
590 $modulePrefix = $module->getModulePrefix();
591 if (strval($modulePrefix) !== '')
592 $modulePrefix = "($modulePrefix) ";
593
594 return "* $paramName={$module->getModuleName()} $modulePrefix*";
595 }
596
597 private $mIsBot = null;
598 private $mIsSysop = null;
599 private $mCanApiHighLimits = null;
600
601 /**
602 * Returns true if the currently logged in user is a bot, false otherwise
603 * OBSOLETE, use canApiHighLimits() instead
604 */
605 public function isBot() {
606 if (!isset ($this->mIsBot)) {
607 global $wgUser;
608 $this->mIsBot = $wgUser->isAllowed('bot');
609 }
610 return $this->mIsBot;
611 }
612
613 /**
614 * Similar to isBot(), this method returns true if the logged in user is
615 * a sysop, and false if not.
616 * OBSOLETE, use canApiHighLimits() instead
617 */
618 public function isSysop() {
619 if (!isset ($this->mIsSysop)) {
620 global $wgUser;
621 $this->mIsSysop = in_array( 'sysop', $wgUser->getGroups());
622 }
623
624 return $this->mIsSysop;
625 }
626
627 /**
628 * Check whether the current user is allowed to use high limits
629 * @return bool
630 */
631 public function canApiHighLimits() {
632 if (!isset($this->mCanApiHighLimits)) {
633 global $wgUser;
634 $this->mCanApiHighLimits = $wgUser->isAllowed('apihighlimits');
635 }
636
637 return $this->mCanApiHighLimits;
638 }
639
640 /**
641 * Check whether the user wants us to show version information in the API help
642 * @return bool
643 */
644 public function getShowVersions() {
645 return $this->mShowVersions;
646 }
647
648 /**
649 * Returns the version information of this file, plus it includes
650 * the versions for all files that are not callable proper API modules
651 */
652 public function getVersion() {
653 $vers = array ();
654 $vers[] = 'MediaWiki: ' . SpecialVersion::getVersion() . "\n http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/";
655 $vers[] = __CLASS__ . ': $Id$';
656 $vers[] = ApiBase :: getBaseVersion();
657 $vers[] = ApiFormatBase :: getBaseVersion();
658 $vers[] = ApiQueryBase :: getBaseVersion();
659 return $vers;
660 }
661
662 /**
663 * Add or overwrite a module in this ApiMain instance. Intended for use by extending
664 * classes who wish to add their own modules to their lexicon or override the
665 * behavior of inherent ones.
666 *
667 * @access protected
668 * @param $mdlName String The identifier for this module.
669 * @param $mdlClass String The class where this module is implemented.
670 */
671 protected function addModule( $mdlName, $mdlClass ) {
672 $this->mModules[$mdlName] = $mdlClass;
673 }
674
675 /**
676 * Add or overwrite an output format for this ApiMain. Intended for use by extending
677 * classes who wish to add to or modify current formatters.
678 *
679 * @access protected
680 * @param $fmtName The identifier for this format.
681 * @param $fmtClass The class implementing this format.
682 */
683 protected function addFormat( $fmtName, $fmtClass ) {
684 $this->mFormats[$fmtName] = $fmtClass;
685 }
686
687 /**
688 * Get the array mapping module names to class names
689 */
690 function getModules() {
691 return $this->mModules;
692 }
693 }
694
695 /**
696 * This exception will be thrown when dieUsage is called to stop module execution.
697 * The exception handling code will print a help screen explaining how this API may be used.
698 *
699 * @ingroup API
700 */
701 class UsageException extends Exception {
702
703 private $mCodestr;
704 private $mExtraData;
705
706 public function __construct($message, $codestr, $code = 0, $extradata = null) {
707 parent :: __construct($message, $code);
708 $this->mCodestr = $codestr;
709 $this->mExtraData = $extradata;
710 }
711 public function getCodeString() {
712 return $this->mCodestr;
713 }
714 public function getMessageArray() {
715 $result = array (
716 'code' => $this->mCodestr,
717 'info' => $this->getMessage()
718 );
719 if ( is_array( $this->mExtraData ) )
720 $result = array_merge( $result, $this->mExtraData );
721 return $result;
722 }
723 public function __toString() {
724 return "{$this->getCodeString()}: {$this->getMessage()}";
725 }
726 }