UNPKG

diesel-core

Version:

Web framework built on Web Standards

2 lines (1 loc) 1.1 kB
var p=Object.create;var{getPrototypeOf:c,defineProperty:r,getOwnPropertyNames:u,getOwnPropertyDescriptor:h}=Object,i=Object.prototype.hasOwnProperty;var T=(s,e,t)=>{t=s!=null?p(c(s)):{};let n=e||!s||!s.__esModule?r(t,"default",{value:s,enumerable:!0}):t;for(let o of u(s))if(!i.call(n,o))r(n,o,{get:()=>s[o],enumerable:!0});return n},a=new WeakMap,d=(s)=>{var e=a.get(s),t;if(e)return e;if(e=r({},"__esModule",{value:!0}),s&&typeof s==="object"||typeof s==="function")u(s).map((n)=>!i.call(e,n)&&r(e,n,{get:()=>s[n],enumerable:!(t=h(s,n))||t.enumerable}));return a.set(s,e),e},m=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var x=(s,e)=>{for(var t in e)r(s,t,{get:e[t],enumerable:!0,configurable:!0,set:(n)=>e[t]=()=>n})};var g=(s,e)=>()=>(s&&(e=s(s=0)),e);class R extends Error{res;status;constructor(s=500,e){super(e?.message,{cause:e?.cause});this.name="HTTPException",this.res=e?.res,this.status=s}getResponse(){if(this.res)return new Response(this.res.body,{status:this.status,headers:this.res.headers});return new Response(this.message,{status:this.status})}}export{R as HTTPException};