D
D
dinya172020-06-22 10:54:55
Yii
dinya17, 2020-06-22 10:54:55

Why doesn't Yii2 catch exceptions when testing with Codeception?

Why doesn't Yii2 catch exceptions when testing with Codeception?
I start testing my application, I do an API test.
Application configured errorHandler

'errorHandler' => [
            'class' => ErrorHandler::class,
        ],


This handler perfectly catches all my exceptions if I pull api with my hands. All errors are globally handled. But when an exception appears, the code will immediately stop the test, preventing the application from processing the error globally.
I debugged everything and errorHandler is connected during testing, the constructor works for it.
Has anyone experienced something similar? Maybe there is some parameter that I forgot to specify and that's why the coding stops everything right away?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dinya17, 2020-06-22
@dinya17

I figured it out, you just need to inherit from HttpException, only in this case Codeception will process everything normally

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question