@sentry/core
Version:
Base implementation for all Sentry JavaScript SDKs
38 lines (35 loc) • 994 B
JavaScript
import { getClient } from '../../currentScopes.js';
import { captureException } from '../../exports.js';
import { getActiveSpan } from '../../utils/spanUtils.js';
import { SPAN_STATUS_ERROR } from '../../tracing/spanstatus.js';
function isJsonRpcServerError(code) {
return ![-32700, -32600, -32601, -32602, -32002].includes(code);
}
function captureError(error, errorType, extraData) {
try {
const client = getClient();
if (!client) {
return;
}
const activeSpan = getActiveSpan();
if (activeSpan?.isRecording()) {
activeSpan.setStatus({
code: SPAN_STATUS_ERROR,
message: "internal_error"
});
}
captureException(error, {
mechanism: {
type: "auto.ai.mcp_server",
handled: false,
data: {
error_type: errorType || "handler_execution",
...extraData
}
}
});
} catch {
}
}
export { captureError, isJsonRpcServerError };
//# sourceMappingURL=errorCapture.js.map