import{context as s,SpanStatusCode as n,trace as a}from"@opentelemetry/api";import{isDevelopMode as o}from"../../utils/envs/is-develop-mode.js";const m=e=>{const t=a?.getSpan(s.active());return t&&(t.setStatus({code:n.ERROR,message:e.message}),t.recordException(e),t.end()),e instanceof Error&&"name"in e&&e.name==="URIError"?new Response("Malformed URL",{status:400}):o()&&e?.name==="PageMissingDefaultExportError"?new Response(e.message,{status:200}):new Response("Internal Server Error",{status:500})};export{m as errorHandler};
