@nine-lab/nine-mu 0.1.362 โ 0.1.364
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 +32 -20
- 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 +32 -18
package/package.json
CHANGED
|
@@ -10,6 +10,7 @@ export const NineExceptionStyles = {
|
|
|
10
10
|
padding: '25px',
|
|
11
11
|
background: '#121314',
|
|
12
12
|
fontFamily: 'Consolas, Monaco, "Courier New", monospace',
|
|
13
|
+
fontSize: '14px',
|
|
13
14
|
textAlign: 'left',
|
|
14
15
|
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
|
|
15
16
|
display: 'flex',
|
|
@@ -156,30 +157,44 @@ export class NineExceptionHook extends React.Component {
|
|
|
156
157
|
return this.props.fallback(this.state.error);
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
|
|
160
|
+
// 1. ๐ ์๋ฌ ๋ฉ์์ง ์์ธํ (๊ธฐ๋ณธ ๋ฉ์์ง ์ธ์ ์๋ฌ ํ์
๊ณผ ํต์ฌ ์์ฝ ์ถ์ถ)
|
|
161
|
+
let errorMessage = '';
|
|
162
|
+
if (this.state.error) {
|
|
163
|
+
const errorName = this.state.error.name ? `[${this.state.error.name}] ` : '';
|
|
164
|
+
const mainMessage = this.state.error.message || String(this.state.error);
|
|
165
|
+
|
|
166
|
+
// ์๋ฌ ๊ฐ์ฒด์ stack ์ ๋ณด๊ฐ ์์ผ๋ฉด ์ฒซ ๋ฒ์งธ ๋ผ์ธ(์์ธ ์์ธ)์ ์กฐํฉํฉ๋๋ค.
|
|
167
|
+
if (this.state.error.stack) {
|
|
168
|
+
const stackLines = this.state.error.stack.split('\n');
|
|
169
|
+
// stack์ ์ฒซ ์ค์ด ์ด๋ฏธ ์๋ฌ๋ช
์ ํฌํจํ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ผ๋ฏ๋ก ์ ์ ํ์ฌ ๋งค์นญ
|
|
170
|
+
errorMessage = stackLines[0].includes(mainMessage)
|
|
171
|
+
? stackLines[0]
|
|
172
|
+
: `${errorName}${mainMessage}`;
|
|
173
|
+
} else {
|
|
174
|
+
errorMessage = `${errorName}${mainMessage}`;
|
|
175
|
+
}
|
|
176
|
+
} else {
|
|
177
|
+
errorMessage = 'Unknown runtime exception occurred.';
|
|
178
|
+
}
|
|
179
|
+
|
|
160
180
|
const customStyles = this.props.styles || {};
|
|
161
181
|
|
|
162
|
-
// ๐ React ์ปดํฌ๋ํธ ์คํ์์
|
|
163
|
-
// ๐ React ์ปดํฌ๋ํธ ์คํ์์ ํ์ผ๋ช
๊ณผ ๋ผ์ธ ๋ฒํธ ์ถ์ถ๊ธฐ (๊ฒฝ๋ก ์ ๋ฐ ์ ์ ๋ฒ์ )
|
|
182
|
+
// 2. ๐ React ์ปดํฌ๋ํธ ์คํ์์ ๋ก์ปฌํธ์คํธ ์ฃผ์๋ฅผ ๊ฑท์ด๋ธ ๊น๋ํ ๊ฒฝ๋ก ์ถ์ถ
|
|
164
183
|
let errorLocation = '';
|
|
165
184
|
if (this.state.errorInfo?.componentStack) {
|
|
166
185
|
const lines = this.state.errorInfo.componentStack.trim().split('\n');
|
|
167
186
|
const targetLine = lines[0] || '';
|
|
168
187
|
|
|
169
|
-
// 1. ๊ธฐ์กด ๋ฐฉ์๋๋ก ์ปดํฌ๋ํธ ์ด๋ฆ๊ณผ ์ ์ฒด ๊ฒฝ๋ก๋ฅผ ๋จผ์ ๋งค์นญํฉ๋๋ค.
|
|
170
188
|
const match = targetLine.match(/at\s+(\w+)\s+\((.*)\)/) || targetLine.match(/at\s+(.*)/);
|
|
171
189
|
if (match) {
|
|
172
190
|
const componentName = match[1];
|
|
173
191
|
let rawPath = match[2] || '';
|
|
174
192
|
|
|
175
|
-
// 2. โญ ํต์ฌ: ๊ฒฝ๋ก์์ 'http://localhost:5173/admin' ๋๋ 'http://.../any-path' ํํธ๋ฅผ ์ฐพ์ ํต์งธ๋ก ๋ ๋ ค๋ฒ๋ฆฝ๋๋ค.
|
|
176
193
|
if (rawPath.includes('http://') || rawPath.includes('https://')) {
|
|
177
|
-
// URL ๊ฐ์ฒด๋ ์ ๊ท์์ ์ด์ฉํด ๋๋ฉ์ธ ์์ญ์ ์ง์ฐ๊ณ /src ํฌ๋งท๋ง ๋จ๊น๋๋ค.
|
|
178
194
|
rawPath = rawPath.replace(/^https?:\/\/[^\/]+/, '');
|
|
179
195
|
}
|
|
180
196
|
|
|
181
|
-
|
|
182
|
-
errorLocation = rawPath ? `${componentName} (${rawPath})` : componentName;
|
|
197
|
+
errorLocation = rawPath ? `at ${componentName} (${rawPath})` : `at ${componentName}`;
|
|
183
198
|
} else {
|
|
184
199
|
errorLocation = targetLine.trim();
|
|
185
200
|
}
|
|
@@ -191,24 +206,24 @@ export class NineExceptionHook extends React.Component {
|
|
|
191
206
|
style: { ...NineExceptionStyles.container, ...customStyles.container, ...this.props.containerStyle }
|
|
192
207
|
},
|
|
193
208
|
|
|
194
|
-
// 1.
|
|
209
|
+
// 1. ์๋ฌ ๊ฐ์ง ๋ก๊ทธ
|
|
195
210
|
React.createElement(
|
|
196
211
|
'div',
|
|
197
212
|
{ style: { ...NineExceptionStyles.systemError, ...customStyles.systemError } },
|
|
198
213
|
'[SYSTEM] COMPONENT RENDER ERROR DETECTED'
|
|
199
214
|
),
|
|
200
215
|
|
|
201
|
-
// 2. aa is not defined
|
|
216
|
+
// 2. ์์ธํ๋ ์๋ฌ ๋ด์ฉ (์: ReferenceError: aa is not defined)
|
|
202
217
|
React.createElement('pre', { style: { ...NineExceptionStyles.pre, ...customStyles.pre } }, errorMessage),
|
|
203
218
|
|
|
204
|
-
// 3.
|
|
219
|
+
// 3. ํ์ฑ๋ ์๋ฌ ๋ฐ์ ํ์ผ๋ช
๋ฐ ๋ผ์ธ ์์น
|
|
205
220
|
errorLocation && React.createElement(
|
|
206
221
|
'div',
|
|
207
222
|
{ style: { ...NineExceptionStyles.locationRow, ...customStyles.locationRow } },
|
|
208
|
-
|
|
223
|
+
errorLocation
|
|
209
224
|
),
|
|
210
225
|
|
|
211
|
-
// 4. CLI ํ๋กฌํํธ
|
|
226
|
+
// 4. CLI ํ๋กฌํํธ ์์ญ
|
|
212
227
|
React.createElement(
|
|
213
228
|
'div',
|
|
214
229
|
{ style: { ...NineExceptionStyles.footer, ...customStyles.footer } },
|
|
@@ -228,18 +243,17 @@ export class NineExceptionHook extends React.Component {
|
|
|
228
243
|
React.createElement('span', null, '/n)?')
|
|
229
244
|
),
|
|
230
245
|
|
|
231
|
-
// display: 'block'๊ณผ margin/padding 0์ ์ฃผ์ด ๋ค๋ฅธ ๋ผ์ธ๋ค๊ณผ ์ค์ฐจ ์์ด ๊ฐ๊ฒฉ์ ๋ง์ถค
|
|
232
246
|
this.state.reportStatus === 'sending' && React.createElement(
|
|
233
247
|
'div',
|
|
234
|
-
{ style: { color: '#ED8936', margin: '0'
|
|
248
|
+
{ style: { color: '#ED8936', margin: '0' } },
|
|
235
249
|
'>> Connecting to Control Tower... Sending payload.'
|
|
236
250
|
),
|
|
237
251
|
|
|
238
252
|
this.state.reportStatus === 'success' && React.createElement(
|
|
239
253
|
'div',
|
|
240
|
-
{ style: {
|
|
241
|
-
React.createElement('div', { style: { color: '#38A169', fontWeight: 'bold'
|
|
242
|
-
React.createElement('div', { style: { color: '#A0AEC0', fontStyle: 'italic', fontSize: '13px'
|
|
254
|
+
{ style: { display: 'flex', flexDirection: 'column', gap: '12px', margin: '0' } },
|
|
255
|
+
React.createElement('div', { style: { color: '#38A169', fontWeight: 'bold' } }, '>> Transmit complete. Core engine initialized.'),
|
|
256
|
+
React.createElement('div', { style: { color: '#A0AEC0', fontStyle: 'italic', fontSize: '13px' } }, 'AI๊ฐ ์์ค ์ฝ๋๋ฅผ ์ฌ์์ ํ๋ ๋์ ์ ์๋ง ๊ธฐ๋ค๋ ค์ฃผ์ธ์...')
|
|
243
257
|
)
|
|
244
258
|
)
|
|
245
259
|
);
|