本文整理汇总了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;未经允许,请勿转载。 |
请发表评论