mirror of
https://github.com/stackblitz-labs/bolt.diy.git
synced 2025-06-18 01:49:07 +01:00
Merge pull request #1688 from xKevIsDev/main
refactor: optimize error handling and npm install performance
This commit is contained in:
commit
b089a4b7f1
@ -27,7 +27,8 @@ const IGNORE_PATTERNS = [
|
|||||||
'**/npm-debug.log*',
|
'**/npm-debug.log*',
|
||||||
'**/yarn-debug.log*',
|
'**/yarn-debug.log*',
|
||||||
'**/yarn-error.log*',
|
'**/yarn-error.log*',
|
||||||
'**/*lock.json',
|
|
||||||
|
// Include this so npm install runs much faster '**/*lock.json',
|
||||||
'**/*lock.yaml',
|
'**/*lock.yaml',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ const IGNORE_PATTERNS = [
|
|||||||
'**/npm-debug.log*',
|
'**/npm-debug.log*',
|
||||||
'**/yarn-debug.log*',
|
'**/yarn-debug.log*',
|
||||||
'**/yarn-error.log*',
|
'**/yarn-error.log*',
|
||||||
'**/*lock.json',
|
|
||||||
|
// Include this so npm install runs much faster '**/*lock.json',
|
||||||
'**/*lock.yaml',
|
'**/*lock.yaml',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -39,27 +39,13 @@ if (!import.meta.env.SSR) {
|
|||||||
console.log('WebContainer preview message:', message);
|
console.log('WebContainer preview message:', message);
|
||||||
|
|
||||||
// Handle both uncaught exceptions and unhandled promise rejections
|
// Handle both uncaught exceptions and unhandled promise rejections
|
||||||
if (
|
if (message.type === 'PREVIEW_UNCAUGHT_EXCEPTION' || message.type === 'PREVIEW_UNHANDLED_REJECTION') {
|
||||||
message.type === 'PREVIEW_UNCAUGHT_EXCEPTION' ||
|
|
||||||
message.type === 'PREVIEW_UNHANDLED_REJECTION' ||
|
|
||||||
message.type === 'PREVIEW_CONSOLE_ERROR'
|
|
||||||
) {
|
|
||||||
const isPromise = message.type === 'PREVIEW_UNHANDLED_REJECTION';
|
const isPromise = message.type === 'PREVIEW_UNHANDLED_REJECTION';
|
||||||
const isConsoleError = message.type === 'PREVIEW_CONSOLE_ERROR';
|
const title = isPromise ? 'Unhandled Promise Rejection' : 'Uncaught Exception';
|
||||||
const title = isPromise
|
|
||||||
? 'Unhandled Promise Rejection'
|
|
||||||
: isConsoleError
|
|
||||||
? 'Console Error'
|
|
||||||
: 'Uncaught Exception';
|
|
||||||
workbenchStore.actionAlert.set({
|
workbenchStore.actionAlert.set({
|
||||||
type: 'preview',
|
type: 'preview',
|
||||||
title,
|
title,
|
||||||
description:
|
description: 'message' in message ? message.message : 'Unknown error',
|
||||||
'message' in message
|
|
||||||
? message.message
|
|
||||||
: 'args' in message && Array.isArray(message.args) && message.args.length > 0
|
|
||||||
? message.args[0]
|
|
||||||
: 'Unknown error',
|
|
||||||
content: `Error occurred at ${message.pathname}${message.search}${message.hash}\nPort: ${message.port}\n\nStack trace:\n${cleanStackTrace(message.stack || '')}`,
|
content: `Error occurred at ${message.pathname}${message.search}${message.hash}\nPort: ${message.port}\n\nStack trace:\n${cleanStackTrace(message.stack || '')}`,
|
||||||
source: 'preview',
|
source: 'preview',
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user