Skip to main content
要启用开发模式,设置 development: true
server.ts
在开发模式下,Bun 会通过内置的错误页面在浏览器中显示错误。
Bun 内置的 500 错误页面

error 回调

要处理服务器端错误,请实现 error 处理程序。发生错误时,返回一个 Response 以发送给客户端。在 development 模式下,此响应会替代 Bun 的默认错误页面。