Skip to content

Commit

Permalink
DOC-458 ErrorReport documentation revision (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
fbeaudoincoveo authored and olamothe committed Feb 15, 2017
1 parent 0b02b6e commit baf5133
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/ui/ErrorReport/ErrorReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,36 @@ export interface IErrorReportOptions {
}

/**
* This component takes care of handling fatal error when doing a query on the index / Search API.<br/>
* For example, it will display a message when the service responds with something like a 401 or 503.<br/>
* It will also render a small text area with the JSON content of the error response, for debugging purpose.
* The ErrorReport component takes care of handling fatal error when doing a query on the index / Search API.
*
* For example, the ErrorReport component displays a message when the service responds with a 401 or 503 error. This
* component also renders a small text area with the JSON content of the error response, for debugging purposes.
*/
export class ErrorReport extends Component {
static ID = 'ErrorReport';

/**
* The options for the component
* @componentOptions
*/
static options: IErrorReportOptions = {

/**
* Display the detailed error message as a JSON in a text content area.<br/>
* The default value is <code>true</code>.
* Specifies whether to display a detailed error message as a JSON in a text content area.
*
* Default value is `true`.
*/
showDetailedError: ComponentOptions.buildBooleanOption({ defaultValue: true })
};
private message: Dom;
private closePopup: () => void;

/**
* Create a new ErrorReport component
* @param element
* @param options
* @param bindings
* Creates a new ErrorReport component.
* @param element The HTMLElement on which to instantiate the component.
* @param options The options for the ErrorReport component.
* @param bindings The bindings that the component requires to function normally. If not set, these will be
* automatically resolved (with a slower execution time).
*/
constructor(public element: HTMLElement, public options?: IErrorReportOptions, bindings?: IComponentBindings) {
super(element, ErrorReport.ID, bindings);
Expand Down Expand Up @@ -68,7 +73,8 @@ export class ErrorReport extends Component {
}

/**
* Do the "back" action in the browser.
* Performs the "back" action in the browser.
* Also logs an `errorBack` event in the usage analytics.
*/
public back(): void {
this.usageAnalytics.logCustomEvent<IAnalyticsNoMeta>(analyticsActionCauseList.errorBack, {}, this.root);
Expand All @@ -77,7 +83,8 @@ export class ErrorReport extends Component {
}

/**
* Reset the current state of the query to 'empty', and trigger a new query.
* Resets the current state of the query and triggers a new query.
* Also logs an `errorClearQuery` event in the usage analytics.
*/
public reset(): void {
this.queryStateModel.reset();
Expand All @@ -87,7 +94,8 @@ export class ErrorReport extends Component {
}

/**
* Retry the same query, in case of a temporary service error.
* Retries the same query, in case of a temporary service error.
* Also logs an `errorRetry` event in the usage analytics.
*/
public retry(): void {
this.usageAnalytics.logSearchEvent<IAnalyticsNoMeta>(analyticsActionCauseList.errorRetry, {});
Expand Down

0 comments on commit baf5133

Please sign in to comment.