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:
parent
404c8d0d88
commit
1e2d879632
|
@ -59,12 +59,7 @@ export class ErrorHandler {
|
|||
|
||||
/** @internal */
|
||||
_findContext(error: any): any {
|
||||
if (error) {
|
||||
return getDebugContext(error) ? getDebugContext(error) :
|
||||
this._findContext(getOriginalError(error));
|
||||
}
|
||||
|
||||
return null;
|
||||
return !error ? null : getDebugContext(error) ?? this._findContext(getOriginalError(error));
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
|
Loading…
Reference in New Issue