@timber-js/app 0.2.0-alpha.136 → 0.2.0-alpha.137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1838,6 +1838,16 @@ async function runProxyPhase(config, getProxy, req, method, path) {
1838
1838
  response: await withSpan("timber.proxy", {}, () => detailed ? withTiming("proxy", "proxy.ts", proxyFn) : proxyFn())
1839
1839
  };
1840
1840
  } catch (error) {
1841
+ if (error instanceof RedirectSignal) return {
1842
+ kind: "redirect",
1843
+ phase: "proxy",
1844
+ signal: error
1845
+ };
1846
+ if (error instanceof DenySignal) return {
1847
+ kind: "deny",
1848
+ phase: "proxy",
1849
+ signal: error
1850
+ };
1841
1851
  return {
1842
1852
  kind: "error",
1843
1853
  phase: "proxy",
@@ -1992,6 +2002,11 @@ async function handleRequest(config, req, method, path, pathIsCanonical) {
1992
2002
  headers: { "Content-Type": `${contentType}; charset=utf-8` }
1993
2003
  });
1994
2004
  } catch (error) {
2005
+ if (error instanceof RedirectSignal) return new Response(null, {
2006
+ status: error.status,
2007
+ headers: { Location: error.location }
2008
+ });
2009
+ if (error instanceof DenySignal) return new Response(null, { status: error.status });
1995
2010
  logRenderError({
1996
2011
  method,
1997
2012
  path,
@@ -3054,6 +3069,7 @@ async function runHandler(handler, ctx) {
3054
3069
  try {
3055
3070
  return mergeResponseHeaders(await handler(ctx), ctx.headers);
3056
3071
  } catch (error) {
3072
+ if (error instanceof DenySignal || error instanceof RedirectSignal) throw error;
3057
3073
  logRouteError({
3058
3074
  method: ctx.req.method,
3059
3075
  path: new URL(ctx.req.url).pathname,