[Dev] Teact: Debug component name on error in effect (#2463)
This commit is contained in:
parent
b1f92f4126
commit
156b0b09da
@ -571,6 +571,8 @@ function useLayoutEffectBase(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`[Teact] Error in effect cleanup at cursor #${cursor} in ${componentInstance.name}`);
|
||||||
handleError(err);
|
handleError(err);
|
||||||
} finally {
|
} finally {
|
||||||
byCursor[cursor].cleanup = undefined;
|
byCursor[cursor].cleanup = undefined;
|
||||||
@ -584,6 +586,7 @@ function useLayoutEffectBase(
|
|||||||
|
|
||||||
execCleanup();
|
execCleanup();
|
||||||
|
|
||||||
|
try {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
let DEBUG_startAt: number | undefined;
|
let DEBUG_startAt: number | undefined;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
@ -603,6 +606,11 @@ function useLayoutEffectBase(
|
|||||||
console.warn(`[Teact] Slow effect at cursor #${cursor}: ${componentName}, ${Math.round(duration)} ms`);
|
console.warn(`[Teact] Slow effect at cursor #${cursor}: ${componentName}, ${Math.round(duration)} ms`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (err: any) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`[Teact] Error in effect at cursor #${cursor} in ${componentInstance.name}`);
|
||||||
|
handleError(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (byCursor[cursor] !== undefined && dependencies && byCursor[cursor].dependencies) {
|
if (byCursor[cursor] !== undefined && dependencies && byCursor[cursor].dependencies) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user