Laravel中的Exception与Throwable各自负责什么样的任务

下面的是框架的源码
图片描述

我想知道源代码中为什么多了一个Throwable?平时写代码都是用Exception的。还请各路大神指教!

阅读 6.1k
2 个回答
Throwable = Exception + Error

Throwable 是 php7 新增的顶级异常 interface,包含了 Error 和 Exception。

Throwable is the base interface for any object that can be thrown via
a throw statement in PHP 7, including Error and Exception.

PHP classes cannot implement the Throwable interface directly, and
must instead extend Exception.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题