File tree Expand file tree Collapse file tree 4 files changed +7
-4
lines changed
AdvancedSearch/Model/Client
Elasticsearch8/SearchAdapter
Elasticsearch/ElasticAdapter/SearchAdapter Expand file tree Collapse file tree 4 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 7
7
8
8
namespace Magento \AdvancedSearch \Model \Client ;
9
9
10
- class ClientException extends \Exception
10
+ use Magento \Framework \Exception \LocalizedException ;
11
+
12
+ class ClientException extends LocalizedException
11
13
{
12
14
13
15
}
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ public function __construct(
83
83
*
84
84
* @param RequestInterface $request
85
85
* @return QueryResponse
86
+ * @throws ClientException
86
87
*/
87
88
public function query (RequestInterface $ request )
88
89
{
@@ -95,7 +96,7 @@ public function query(RequestInterface $request)
95
96
$ rawResponse = $ client ->query ($ query );
96
97
} catch (\Exception $ e ) {
97
98
$ this ->logger ->critical ($ e );
98
- throw new ClientException (__ ($ e -> getMessage () ), $ e ->getCode (), $ e );
99
+ throw new ClientException (__ (" Could not perform search query. " ), $ e ->getCode (), $ e );
99
100
}
100
101
101
102
$ rawDocuments = isset ($ rawResponse ['hits ' ]['hits ' ]) ? $ rawResponse ['hits ' ]['hits ' ] : [];
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public function query(RequestInterface $request): QueryResponse
98
98
$ rawResponse = $ client ->query ($ query );
99
99
} catch (\Exception $ e ) {
100
100
$ this ->logger ->critical ($ e );
101
- throw new ClientException ($ e -> getMessage ( ), $ e ->getCode (), $ e );
101
+ throw new ClientException (__ ( " Could not perform search query. " ), $ e ->getCode (), $ e );
102
102
}
103
103
104
104
$ rawDocuments = $ rawResponse ['hits ' ]['hits ' ] ?? [];
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ public function query(RequestInterface $request) : QueryResponse
138
138
);
139
139
} catch (\Exception $ e ) {
140
140
$ this ->logger ->critical ($ e );
141
- throw new ClientException ($ e -> getMessage ( ), $ e ->getCode (), $ e );
141
+ throw new ClientException (__ ( " Could not perform search query. " ), $ e ->getCode (), $ e );
142
142
} finally {
143
143
if (isset ($ pitId )) {
144
144
$ client ->closePointInTime (['body ' => ['pit_id ' => [$ pitId ]]]);
You can’t perform that action at this time.
0 commit comments