Skip to content

Commit

Permalink
[Search] Error notification alignment (#77788) (#78634)
Browse files Browse the repository at this point in the history
* OSS error alignemnt

* Adjust error messages in xpack

* Add getErrorMessage

* Use showError in vizualize
Add original error to expression exception

* Cleanup

* ts, doc and i18n fixes

* Fix jest tests

* Fix functional test

* functional test

* ts

* Update functional tests

* Add unit tests to interceptor and timeout error

* expose toasts test function

* doc

* typos

* review 1

* Code review

* doc

* doc fix

* visualization type fix

* fix jest

* Fix xpack functional test

* fix xpack test

* code review

* delete debubg flag

* Update texts by @gchaps

* docs and ts

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
lizozom and elasticmachine authored Sep 29, 2020
1 parent 9b3e54e commit 7918405
Show file tree
Hide file tree
Showing 50 changed files with 849 additions and 465 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ export interface ISearchStart
| [aggs](./kibana-plugin-plugins-data-public.isearchstart.aggs.md) | <code>AggsStart</code> | agg config sub service [AggsStart](./kibana-plugin-plugins-data-public.aggsstart.md) |
| [search](./kibana-plugin-plugins-data-public.isearchstart.search.md) | <code>ISearchGeneric</code> | low level search [ISearchGeneric](./kibana-plugin-plugins-data-public.isearchgeneric.md) |
| [searchSource](./kibana-plugin-plugins-data-public.isearchstart.searchsource.md) | <code>ISearchStartSearchSource</code> | high level search [ISearchStartSearchSource](./kibana-plugin-plugins-data-public.isearchstartsearchsource.md) |
| [showError](./kibana-plugin-plugins-data-public.isearchstart.showerror.md) | <code>(e: Error) =&gt; void</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [ISearchStart](./kibana-plugin-plugins-data-public.isearchstart.md) &gt; [showError](./kibana-plugin-plugins-data-public.isearchstart.showerror.md)

## ISearchStart.showError property

<b>Signature:</b>

```typescript
showError: (e: Error) => void;
```
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
| [IndexPatternSelect](./kibana-plugin-plugins-data-public.indexpatternselect.md) | |
| [IndexPatternsService](./kibana-plugin-plugins-data-public.indexpatternsservice.md) | |
| [OptionedParamType](./kibana-plugin-plugins-data-public.optionedparamtype.md) | |
| [PainlessError](./kibana-plugin-plugins-data-public.painlesserror.md) | |
| [Plugin](./kibana-plugin-plugins-data-public.plugin.md) | |
| [RequestTimeoutError](./kibana-plugin-plugins-data-public.requesttimeouterror.md) | Class used to signify that a request timed out. Useful for applications to conditionally handle this type of error differently than other errors. |
| [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) | |
| [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) | \* |
| [SearchTimeoutError](./kibana-plugin-plugins-data-public.searchtimeouterror.md) | Request Failure - When an entire multi request fails |
| [TimeHistory](./kibana-plugin-plugins-data-public.timehistory.md) | |

## Enumerations
Expand All @@ -35,6 +36,7 @@
| [METRIC\_TYPES](./kibana-plugin-plugins-data-public.metric_types.md) | |
| [QuerySuggestionTypes](./kibana-plugin-plugins-data-public.querysuggestiontypes.md) | |
| [SortDirection](./kibana-plugin-plugins-data-public.sortdirection.md) | |
| [TimeoutErrorMode](./kibana-plugin-plugins-data-public.timeouterrormode.md) | |

## Functions

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [PainlessError](./kibana-plugin-plugins-data-public.painlesserror.md) &gt; [(constructor)](./kibana-plugin-plugins-data-public.painlesserror._constructor_.md)

## PainlessError.(constructor)

Constructs a new instance of the `PainlessError` class

<b>Signature:</b>

```typescript
constructor(err: EsError, request: IKibanaSearchRequest);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| err | <code>EsError</code> | |
| request | <code>IKibanaSearchRequest</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [PainlessError](./kibana-plugin-plugins-data-public.painlesserror.md) &gt; [getErrorMessage](./kibana-plugin-plugins-data-public.painlesserror.geterrormessage.md)

## PainlessError.getErrorMessage() method

<b>Signature:</b>

```typescript
getErrorMessage(application: ApplicationStart): JSX.Element;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| application | <code>ApplicationStart</code> | |

<b>Returns:</b>

`JSX.Element`

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [PainlessError](./kibana-plugin-plugins-data-public.painlesserror.md)

## PainlessError class

<b>Signature:</b>

```typescript
export declare class PainlessError extends KbnError
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(err, request)](./kibana-plugin-plugins-data-public.painlesserror._constructor_.md) | | Constructs a new instance of the <code>PainlessError</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [painlessStack](./kibana-plugin-plugins-data-public.painlesserror.painlessstack.md) | | <code>string</code> | |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [getErrorMessage(application)](./kibana-plugin-plugins-data-public.painlesserror.geterrormessage.md) | | |
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [PainlessError](./kibana-plugin-plugins-data-public.painlesserror.md) &gt; [painlessStack](./kibana-plugin-plugins-data-public.painlesserror.painlessstack.md)

## PainlessError.painlessStack property

<b>Signature:</b>

```typescript
painlessStack?: string;
```

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [getTimeoutMode](./kibana-plugin-plugins-data-public.searchinterceptor.gettimeoutmode.md)

## SearchInterceptor.getTimeoutMode() method

<b>Signature:</b>

```typescript
protected getTimeoutMode(): TimeoutErrorMode;
```
<b>Returns:</b>

`TimeoutErrorMode`

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [handleSearchError](./kibana-plugin-plugins-data-public.searchinterceptor.handlesearcherror.md)

## SearchInterceptor.handleSearchError() method

<b>Signature:</b>

```typescript
protected handleSearchError(e: any, request: IKibanaSearchRequest, timeoutSignal: AbortSignal, appAbortSignal?: AbortSignal): Error;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| e | <code>any</code> | |
| request | <code>IKibanaSearchRequest</code> | |
| timeoutSignal | <code>AbortSignal</code> | |
| appAbortSignal | <code>AbortSignal</code> | |

<b>Returns:</b>

`Error`

Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ export declare class SearchInterceptor
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [deps](./kibana-plugin-plugins-data-public.searchinterceptor.deps.md) | | <code>SearchInterceptorDeps</code> | |
| [showTimeoutError](./kibana-plugin-plugins-data-public.searchinterceptor.showtimeouterror.md) | | <code>((e: Error) =&gt; void) &amp; import(&quot;lodash&quot;).Cancelable</code> | |

## Methods

| Method | Modifiers | Description |
| --- | --- | --- |
| [getTimeoutMode()](./kibana-plugin-plugins-data-public.searchinterceptor.gettimeoutmode.md) | | |
| [handleSearchError(e, request, timeoutSignal, appAbortSignal)](./kibana-plugin-plugins-data-public.searchinterceptor.handlesearcherror.md) | | |
| [search(request, options)](./kibana-plugin-plugins-data-public.searchinterceptor.search.md) | | Searches using the given <code>search</code> method. Overrides the <code>AbortSignal</code> with one that will abort either when <code>cancelPending</code> is called, when the request times out, or when the original <code>AbortSignal</code> is aborted. Updates <code>pendingCount$</code> when the request is started/finalized. |
| [showError(e)](./kibana-plugin-plugins-data-public.searchinterceptor.showerror.md) | | |

Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ Searches using the given `search` method. Overrides the `AbortSignal` with one t
<b>Signature:</b>

```typescript
search(request: IEsSearchRequest, options?: ISearchOptions): Observable<IKibanaSearchResponse>;
search(request: IKibanaSearchRequest, options?: ISearchOptions): Observable<IKibanaSearchResponse>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| request | <code>IEsSearchRequest</code> | |
| request | <code>IKibanaSearchRequest</code> | |
| options | <code>ISearchOptions</code> | |

<b>Returns:</b>

`Observable<IKibanaSearchResponse>`

`Observalbe` emitting the search response or an error.

Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [showTimeoutError](./kibana-plugin-plugins-data-public.searchinterceptor.showtimeouterror.md)
[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchInterceptor](./kibana-plugin-plugins-data-public.searchinterceptor.md) &gt; [showError](./kibana-plugin-plugins-data-public.searchinterceptor.showerror.md)

## SearchInterceptor.showTimeoutError property
## SearchInterceptor.showError() method

<b>Signature:</b>

```typescript
protected showTimeoutError: ((e: Error) => void) & import("lodash").Cancelable;
showError(e: Error): void;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| e | <code>Error</code> | |

<b>Returns:</b>

`void`

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchTimeoutError](./kibana-plugin-plugins-data-public.searchtimeouterror.md) &gt; [(constructor)](./kibana-plugin-plugins-data-public.searchtimeouterror._constructor_.md)

## SearchTimeoutError.(constructor)

Constructs a new instance of the `SearchTimeoutError` class

<b>Signature:</b>

```typescript
constructor(err: Error, mode: TimeoutErrorMode);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| err | <code>Error</code> | |
| mode | <code>TimeoutErrorMode</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchTimeoutError](./kibana-plugin-plugins-data-public.searchtimeouterror.md) &gt; [getErrorMessage](./kibana-plugin-plugins-data-public.searchtimeouterror.geterrormessage.md)

## SearchTimeoutError.getErrorMessage() method

<b>Signature:</b>

```typescript
getErrorMessage(application: ApplicationStart): JSX.Element;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| application | <code>ApplicationStart</code> | |

<b>Returns:</b>

`JSX.Element`

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchTimeoutError](./kibana-plugin-plugins-data-public.searchtimeouterror.md)

## SearchTimeoutError class

Request Failure - When an entire multi request fails

<b>Signature:</b>

```typescript
export declare class SearchTimeoutError extends KbnError
```
## Constructors
| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(err, mode)](./kibana-plugin-plugins-data-public.searchtimeouterror._constructor_.md) | | Constructs a new instance of the <code>SearchTimeoutError</code> class |
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [mode](./kibana-plugin-plugins-data-public.searchtimeouterror.mode.md) | | <code>TimeoutErrorMode</code> | |
## Methods
| Method | Modifiers | Description |
| --- | --- | --- |
| [getErrorMessage(application)](./kibana-plugin-plugins-data-public.searchtimeouterror.geterrormessage.md) | | |
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [SearchTimeoutError](./kibana-plugin-plugins-data-public.searchtimeouterror.md) &gt; [mode](./kibana-plugin-plugins-data-public.searchtimeouterror.mode.md)

## SearchTimeoutError.mode property

<b>Signature:</b>

```typescript
mode: TimeoutErrorMode;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [TimeoutErrorMode](./kibana-plugin-plugins-data-public.timeouterrormode.md)

## TimeoutErrorMode enum

<b>Signature:</b>

```typescript
export declare enum TimeoutErrorMode
```

## Enumeration Members

| Member | Value | Description |
| --- | --- | --- |
| CHANGE | <code>2</code> | |
| CONTACT | <code>1</code> | |
| UPGRADE | <code>0</code> | |

2 changes: 1 addition & 1 deletion examples/search_examples/server/my_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const mySearchStrategyProvider = (
): ISearchStrategy<IMyStrategyRequest, IMyStrategyResponse> => {
const es = data.search.getSearchStrategy('es');
return {
search: async (context, request, options) => {
search: async (context, request, options): Promise<IMyStrategyResponse> => {
const esSearchRes = await es.search(context, request, options);
return {
...esSearchRes,
Expand Down
Loading

0 comments on commit 7918405

Please sign in to comment.