當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript core.ErrorHandler類代碼示例

本文整理匯總了TypeScript中@angular/core.ErrorHandler的典型用法代碼示例。如果您正苦於以下問題:TypeScript ErrorHandler類的具體用法?TypeScript ErrorHandler怎麽用?TypeScript ErrorHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ErrorHandler類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: computeNextEntry

/**
 * Computes the next entry in the log by applying an action.
 */
function computeNextEntry(
  reducer: ActionReducer<any, any>,
  action: Action,
  state: any,
  error: any,
  errorHandler: ErrorHandler
) {
  if (error) {
    return {
      state,
      error: 'Interrupted by an error up the chain',
    };
  }

  let nextState = state;
  let nextError;
  try {
    nextState = reducer(state, action);
  } catch (err) {
    nextError = err.toString();
    errorHandler.handleError(err.stack || err);
  }

  return {
    state: nextState,
    error: nextError,
  };
}
開發者ID:AlexChar,項目名稱:platform,代碼行數:31,代碼來源:reducer.ts

示例2: reportInvalidActions

function reportInvalidActions(
  output: EffectNotification,
  reporter: ErrorHandler
) {
  if (output.notification.kind === 'N') {
    const action = output.notification.value;
    const isInvalidAction = !isAction(action);

    if (isInvalidAction) {
      reporter.handleError(
        new Error(
          `Effect ${getEffectName(output)} dispatched an invalid action: ${
            action
          }`
        )
      );
    }
  }
}
開發者ID:WinGood,項目名稱:platform,代碼行數:19,代碼來源:effect_notification.ts

示例3: reportErrorThrown

function reportErrorThrown(output: EffectNotification, reporter: ErrorHandler) {
  if (output.notification.kind === 'E') {
    reporter.handleError(output.notification.error);
  }
}
開發者ID:WinGood,項目名稱:platform,代碼行數:5,代碼來源:effect_notification.ts

示例4: catch

				( event: T ) : void => {

					try {

						callback.call( callbackContext, event );
						
					} catch ( error ) {

						this.errorHandler.handleError( error );

					}

				}
開發者ID:bennadel,項目名稱:JavaScript-Demos,代碼行數:13,代碼來源:message-bus.ts

示例5: normalizeError

	// ---
	// PRIVATE METHODS.
	// ---

	// Errors can occur for a variety of reasons. I normalize the error response so that
	// the calling context can assume a standard error structure.
	private normalizeError( error: any ) : ErrorResponse {

		this.errorHandler.handleError( error );

		// NOTE: Since I'm not really dealing with a production API, this doesn't really
		// normalize anything (ie, this is not the focus of this demo).
		return({
			id: "-1",
			code: "UnknownError",
			message: "An unexpected error occurred."
		});

	}
開發者ID:bennadel,項目名稱:JavaScript-Demos,代碼行數:19,代碼來源:api-client.ts

示例6: handleError

 handleError(err) {
   this.modal.show({
     title: 'Uncaught ' + (err.name || 'Error'),
     body: `
       <p>${err.message}</p>
       <hr/>
       <pre>${err.stack}</pre>
     `,
     secondaryButton: 'Okay',
     height: 400,
     width: 700
   });
   this.defaultHandler.handleError(err);
 }
開發者ID:PRX,項目名稱:publish.prx.org,代碼行數:14,代碼來源:error.service.ts

示例7: error

 error(value: any, ...rest: any[]) {
   const message = [value, ...rest].join(' ');
   this.errorHandler.handleError(message);
 }
開發者ID:cironunes,項目名稱:angular,代碼行數:4,代碼來源:logger.service.ts

示例8: error

 error(error: Error) {
   this.errorHandler.handleError(error);
 }
開發者ID:BobChao87,項目名稱:angular,代碼行數:3,代碼來源:logger.service.ts

示例9:

this._ngxsExecutionStrategy.leave(() => this._errorHandler.handleError(error))
開發者ID:LucasFrecia,項目名稱:store,代碼行數:1,代碼來源:dispatcher.ts

示例10:

 }, error => {
   this.errorHandler.handleError(error); 
 });
開發者ID:codeforcologne,項目名稱:sagsunskoeln-app,代碼行數:3,代碼來源:all-submissions-provider.ts


注:本文中的@angular/core.ErrorHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。