# SearchQueryError

> Represents a query parsing error.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor.Search](/engine/6000.6/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

```csharp
public class SearchQueryError
```

## Remarks

This class is only used in the context of [SearchProviders](/engine/6000.6/script-reference/unityeditor/search/searchprovider.md), when performing a search. It allows a [SearchProvider](/engine/6000.6/script-reference/unityeditor/search/searchprovider.md) to report error during the parsing of the search query. Here is an example of a [SearchProvider](/engine/6000.6/script-reference/unityeditor/search/searchprovider.md) that uses a [QueryEngine](/engine/6000.6/script-reference/unityeditor/search/queryengine1.md) and reports parsing errors:

```csharp
var query = m_QueryEngine.ParseQuery(context.searchQuery);
if (!query.valid)
{
    context.AddSearchQueryErrors(query.errors.Select(e => new SearchQueryError(e, context, this)));
    return Array.Empty<SearchItem>();
}
```

In the previous example, the function "Search" would be called by the provider's fetchItem.

In the Search window, the errors are shown when there is no result available. ![Example SearchQueryError (SearchQueryError)](/api/media?file=/engine/6000.6/media/images/Example_SearchQueryError.png).

## Constructors

| Constructor                                                                                                                                                                                                                                                                                                                                                  | Description                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| [SearchQueryError(System.Int32,System.Int32,System.String,UnityEditor.Search.SearchContext,UnityEditor.Search.SearchProvider,System.Boolean,UnityEditor.Search.SearchQueryErrorType)](/engine/6000.6/script-reference/unityeditor/search/searchqueryerror/ctor.md#searchqueryerror\(int-int-string-searchcontext-searchprovider-bool-searchqueryerrortype\)) | Creates a new SearchQueryError.                                                                                                 |
| [SearchQueryError(UnityEditor.Search.QueryError,UnityEditor.Search.SearchContext,UnityEditor.Search.SearchProvider,System.Boolean)](/engine/6000.6/script-reference/unityeditor/search/searchqueryerror/ctor.md#searchqueryerror\(queryerror-searchcontext-searchprovider-bool\))                                                                            | Creates a new SearchQueryError from an existing [QueryError](/engine/6000.6/script-reference/unityeditor/search/queryerror.md). |

## Properties

| Property                                                                                    | Description                                 |
| ------------------------------------------------------------------------------------------- | ------------------------------------------- |
| [context](/engine/6000.6/script-reference/unityeditor/search/searchqueryerror/context.md)   | The context in which this error was logged. |
| [index](/engine/6000.6/script-reference/unityeditor/search/searchqueryerror/index.md)       | Index where the error occurred.             |
| [length](/engine/6000.6/script-reference/unityeditor/search/searchqueryerror/length.md)     | Length of the block that was being parsed.  |
| [provider](/engine/6000.6/script-reference/unityeditor/search/searchqueryerror/provider.md) | Which search provider logged this error.    |
| [reason](/engine/6000.6/script-reference/unityeditor/search/searchqueryerror/reason.md)     | The reason for the error.                   |
| [type](/engine/6000.6/script-reference/unityeditor/search/searchqueryerror/type.md)         | The type of query error.                    |
