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 use nullish coalescing operator instead conditional operator when getDebugContext's result does not exist.

PR Close #42581
This commit is contained in:
Arthur Ming 2021-06-16 16:28:56 +08:00 committed by Andrew Kushnir
parent 404c8d0d88
commit 1e2d879632
1 changed files with 1 additions and 6 deletions

View File

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