Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
monaco.editor.defineTheme('CodeSandbox', {
base: getBase(transformedTheme.type),
inherit: true,
colors: transformedTheme.colors,
rules: transformedTheme.rules,
});
monaco.editor.setTheme('CodeSandbox');
} catch (e) {
console.error(e);
notificationState.addNotification({
message: `Problem initializing template in editor: ${e.message}`,
status: NotificationStatus.ERROR,
});
}
}
};
.then(text => {
let theme;
try {
theme = parseTheme(text);
} catch (e) {
console.error(e);
notificationState.addNotification({
message: 'We had trouble loading the theme, error: \n' + e.message,
status: NotificationStatus.ERROR,
});
}
return theme;
});
}
const findTheme = async (themeName, customTheme) => {
if (customTheme) {
try {
return parseTheme(customTheme);
} catch (e) {
console.error(e);
notificationState.addNotification({
message:
'We had trouble parsing your custom VSCode Theme, error: \n' +
e.message,
status: NotificationStatus.ERROR,
});
}
}
const foundTheme = themes.find(t => t.name === themeName);
const fetchedTheme = await fetchTheme(foundTheme);
return {
...fetchedTheme,
type: (foundTheme && foundTheme.type) || fetchedTheme.type,
};
};
path="/"
render={({ location }) => {
if (process.env.NODE_ENV === 'production') {
routeDebugger(
`Sending '${location.pathname + location.search}' to analytics.`
);
if (!DNT) {
trackPageview();
}
}
return null;
}}
/>
<content>
</content>
},
});
} else if (
error.message.startsWith(
'You reached the limit of server sandboxes, we will increase the limit in the future. Please contact hello@codesandbox.io for more server sandboxes.'
)
) {
effects.analytics.track('Patron Server Sandbox Limit Reached', {
errorMessage: error.message,
});
}
effects.notificationToast.add({
title: message,
message: error.message,
status: NotificationStatus.ERROR,
...(notificationActions.primary.length
? { actions: notificationActions }
: {}),
});
};
const errorHandler = onError(({ graphQLErrors, networkError }) => {
if (graphQLErrors) {
graphQLErrors.forEach(({ message }) => {
notificationState.addNotification({
message,
status: NotificationStatus.ERROR,
});
});
}
if (networkError) {
notificationState.addNotification({
message: `Network Error: ${networkError}`,
status: NotificationStatus.ERROR,
});
}
});
export function convertTypeToStatus(
type: NotificationType
): NotificationStatus {
switch (type) {
case 'notice':
return NotificationStatus.NOTICE;
case 'warning':
return NotificationStatus.WARNING;
case 'error':
return NotificationStatus.ERROR;
case 'success':
return NotificationStatus.SUCCESS;
default:
return NotificationStatus.NOTICE;
}
}
primary: [
{
label: 'Sign in',
run: () => {
controller.getSignal('signInClicked')({});
},
},
],
},
});
} else if (errorMessage.startsWith('You reached the maximum of')) {
track('Non-Patron Sandbox Limit Reached', { errorMessage });
notificationState.addNotification({
title: errorMessage,
status: NotificationStatus.ERROR,
actions: {
primary: [
{
label: 'Open Patron Page',
run: () => {
window.open(patronUrl(), '_blank');
},
},
],
},
});
} else if (
errorMessage.startsWith(
'You reached the limit of server sandboxes, you can create more server sandboxes as a patron.'
)
) {
export function showContainerError({ props }) {
if (props.unrecoverable) {
notificationState.addNotification({
title: `Container Error`,
message: props.error,
status: NotificationStatus.ERROR,
});
} else {
notificationState.addNotification({
title: `Container Warning`,
message: props.error,
status: NotificationStatus.WARNING,
});
}
}