@nine-lab/nine-mu 0.1.336 โ 0.1.337
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nine-mu.js +15 -15
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +1 -1
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/exception/ExceptionHook.js +17 -14
package/package.json
CHANGED
|
@@ -57,32 +57,35 @@ export class ExceptionHook extends HTMLElement {
|
|
|
57
57
|
this.shadowRoot.appendChild(link);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
// src/components/exception/ExceptionHook.js
|
|
61
|
-
|
|
62
60
|
#handleRuntimeError = (event) => {
|
|
63
61
|
if (this.#hasError) return;
|
|
64
62
|
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
const
|
|
63
|
+
// 1. ์๋ฌ ๋ฉ์์ง ์ถ์ถ (event ๊ฐ์ฒด ์์ฒด ๋๋ event.error์์ ํ๊ฒํ
)
|
|
64
|
+
const errorMessage = event.error?.message || event.message || String(event);
|
|
65
|
+
const errorStack = event.error?.stack || "No stack trace available";
|
|
68
66
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const stack = event.error?.stack || "Stack trace unavailable";
|
|
67
|
+
// 2. ๊ฐ๋ฐ ํ๊ฒฝ(Vite, Webpack) ๋ฐ ๋ฆฌ์กํธ ํน์ ์ ๋ฌด์กฐ๊ฑด์ ์ธ ์ ์ญ ์๋ฌ ์ ํ ์บ์น
|
|
68
|
+
// ๋ฆฌ์กํธ ์๋ฌ๋ ๋ณดํต ์ ์ญ window๋ก ๋์ ธ์ง๋ฏ๋ก, ์ด ํ
์ด ๋ ์๋ ์ํ๋ผ๋ฉด ๊ทธ๋ฅ ๊ฐ์ฐจ์์ด ์ก์์ผ ํฉ๋๋ค.
|
|
69
|
+
if (errorMessage) {
|
|
73
70
|
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
this.#renderError(
|
|
71
|
+
// 3. ๋ฆฌ์กํธ๊ฐ ์๋ฌ ๋๋ฌธ์ <slot> ๋ด๋ถ DOM์ ํต์งธ๋ก Unmount(ํ๊ดด)ํด๋ฒ๋ฆฌ๋ ๊ฒ์ ๋ฐฉ์งํ๊ธฐ ์ํด
|
|
72
|
+
// ๋ธ๋ผ์ฐ์ ๋ฒ๋ธ๋ง์ ์ฆ์ ์ฐจ๋จํ๊ณ , ์๋ฌ ๋ณด๋๋ฅผ ์ฆ๊ฐ ๊ทธ๋ฆฌ๋๋ก ์์๋ฅผ ๊ฐ๋ก์ฑ๋๋ค.
|
|
73
|
+
this.#renderError(errorMessage, errorStack);
|
|
77
74
|
|
|
78
|
-
// ๋ธ๋ผ์ฐ์ ๊ธฐ๋ณธ
|
|
75
|
+
// ํ์์ ๋ธ๋ผ์ฐ์ ๊ธฐ๋ณธ ๋นจ๊ฐ ์๋ฌ์ฐฝ(Vite Overlay ๋ฑ) ์ต์ ์ํ ๋ ํ์ฑํ
|
|
79
76
|
// event.preventDefault();
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
|
|
83
80
|
#handlePromiseError = (event) => {
|
|
84
81
|
if (this.#hasError) return;
|
|
85
|
-
|
|
82
|
+
|
|
83
|
+
// ๋น๋๊ธฐ ํ
(useEffect ์์ null.data ๊ฐ์ Promise ๊ฑฐ๋ถ) ์๋ฌ ์บ์น
|
|
84
|
+
const reason = event.reason;
|
|
85
|
+
const errorMessage = reason?.message || String(reason || "Unhandled Promise Rejection");
|
|
86
|
+
const errorStack = reason?.stack || "No stack trace available";
|
|
87
|
+
|
|
88
|
+
this.#renderError(errorMessage, errorStack);
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
#handleLocationChange = () => {
|