Skip to content

Commit 6d60002

Browse files
committed
Allow set search engine used to search exception messages
1 parent 952f6aa commit 6d60002

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

guide/index.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ Exception Handler Config Options
645645
'development_view' => null,
646646
'production_view' => null,
647647
'initialize' => true,
648+
'search_engine' => 'google',
648649
'handle_errors' => true,
649650
],
650651
],
@@ -682,7 +683,17 @@ initialize
682683
""""""""""
683684

684685
Set if it is to initialize by setting the class as exception handler. The
685-
default value is ``true``.
686+
default value is ``true``.
687+
688+
search_engine
689+
"""""""""""""
690+
Set the search engine used to create search links on exception error messages.
691+
Valid values are: ``ask``, ``baidu``, ``bing``, ``duckduckgo``, ``google``,
692+
``yahoo`` and ``yandex``. The default is ``google``.
693+
694+
695+
Set if it is to initialize by setting the class as exception handler. The
696+
default value is ``true``.
686697

687698
handle_errors
688699
"""""""""""""

src/App.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,9 @@ protected static function setExceptionHandler(string $instance) : ExceptionHandl
626626
if ($config['initialize'] === true) {
627627
$service->initialize($config['handle_errors'] ?? true);
628628
}
629+
if (isset($config['search_engine'])) {
630+
$service->getSearchEngines()->setCurrent($config['search_engine']);
631+
}
629632
return static::setService('exceptionHandler', $service, $instance);
630633
}
631634

tests/configs/exceptionHandler.config.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
'development_view' => __FILE__,
1616
'production_view' => __FILE__,
1717
'initialize' => true,
18+
'search_engine' => 'bing',
1819
'logger_instance' => 'default',
1920
'language_instance' => 'default',
2021
],

0 commit comments

Comments
 (0)