refactor(core): optimize the implementation about finding context from error in ErrorHandler (#42581)

in _findContext method, use conditional operator check whether the params 'error' exists and then us reccursion way to find context in original error  if getDebugContext's result does not exist.

PR Close #42581
This commit is contained in:
Arthur Ming 2021-06-23 11:39:35 +08:00 committed by Andrew Kushnir
parent 1067be7ab8
commit e8be045cbd
1 changed files with 1 additions and 1 deletions

View File

@ -59,7 +59,7 @@ export class ErrorHandler {
/** @internal */
_findContext(error: any): any {
return !error ? null : getDebugContext(error) ?? this._findContext(getOriginalError(error));
return error ? (getDebugContext(error) || this._findContext(getOriginalError(error))) : null;
}
/** @internal */