handle errors in before blocks for sse routes