开发者

Exception - instance error

When you start catching exception and the exceptions autoloader controller error pops up:

Argument 1 passed to Controller_Exception:: __construct () must be an instance of Autoloader_Exception, string given, Called in 'sourc开发者_如何转开发e'


try {} catch (Autoloader_Exception $ e){ throw new Controller_Exception ('Some Error');  }}

Controller_Exception class { public function __construct ($ Autoloader_Exception e) { } }

Question two, how can I build an exception class? Does anybody know a good example?


The first issue is that you are using

new Controller_Exception ('Some Error')

According to the error message 'Some Error' must be an Autoloader_Exception. Depending on what you want to do you could use:

new Controller_Exception ($e)

For the second question you can read about creating your own exceptions here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜