export abstract class MiniflareError < Code extends string | number = string | number > extends Error { constructor ( readonly code , message ? , readonly cause ? ) { super ( message ) ; Object . setPrototypeOf ( this , new . target . prototype ) ; this . name = `${ new . target . name } [${ code }]` ; } } export function prefixError ( prefix , e ) { if ( e . stack ) { return new Proxy ( e , { get ( target , propertyKey , receiver ) { const value = Reflect . get ( target , propertyKey , receiver ) ; return propertyKey === "stack" ? `${ prefix }: ${ value }` : value ; } , } ) ; } return e ; }