Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const messages = errors.map(({ error, contextName }) => {
// TODO a breadcrumb for originError
Sentry.captureException(error)
return this.getConnectionErrorMessage(error, contextName)
})
Sentry.withScope(scope => {
scope.setExtra(errorInfo)
this.setState({ eventId: Sentry.captureException(error) })
})
/* Collect user feedback as follow up. */
const target = await getTarget(kubeConfig, resource, forward)
const result = await startForward(commit, k8sPortForward, service, target)
return { ...result, service, forward, target }
}))
const success = !results.find(x => !x.success)
if (!success) {
for (const result of results) {
killServer(commit, result.target.localPort)
}
}
return { success, results }
} catch (error) {
// TODO a breadcrumb for originError
Sentry.captureException(error)
clearStates(commit, service)
return { success: false, error }
}
},
function openProject(arg) {
console.log("openProject", arg);
if (!arg || arg.length === 0) return;
let projectFilePath = path.join(arg, "project.pbp");
if (!fs.existsSync(projectFilePath)) {
console.error("No project file found");
dialog.showErrorBox("Not found", "Could not find a PluginBlueprint project in that directory");
Sentry.captureException(err);
return;
}
try {
global.analytics.event("Project", "Open Project").send();
} catch (e) {
console.warn(e);
}
fs.readFile(projectFilePath, "utf-8", function (err, data) {
if (err) {
console.error("Failed to read project file");
console.error(err);
Sentry.captureException(err);
return;
}
data = JSON.parse(data);
}).catch(err => {
console.error(err);
Sentry.captureException(err);
})
}
export function throwError(err) {
console.error(err);
if (process.env.NODE_ENV === 'production') {
Sentry.captureException(err);
}
}
fs.remove(folder, (removeErr) => {
if (removeErr) {
console.error(removeErr);
Sentry.captureException(removeErr);
}
ipc.send('capture-folder-upload-finished', folder, userId, spectator);
window.close();
});
};
Sentry.withScope(scope => {
scope.setExtra('componentStack', info.componentStack)
scope.setTag('area', this.props.plugin.id)
const eventId = Sentry.captureException(error)
this.setState({
hasError: true,
error,
info,
eventId,
})
})
}
process.on('uncaughtException', error => {
Sentry.captureException(error)
})
sentryLog(level, originalMsg, data, message) {
addBreadcrumb({
level,
message,
data,
category: `${this.processName}:${this.name}`
});
if (originalMsg instanceof Error) {
captureException(originalMsg);
}
}