Zend expressive authentication catch error

I am using Zend Expressive to create APIRest

I’m using Htpasswd.

      'aliases'    => [
                    AuthenticationInterface::class => Basic\BasicAccess::class,
                    UserRepositoryInterface::class => UserRepository\Htpasswd::class
                ]

It works correctly and makes the validation,
But when I pass a wrong user I get an exception
{
“exception”: {
“class”: “ErrorException”,
“code”: 0,
“message”: “Undefined offset: 1”,
“file”: “/var/www/vendor/zendframework/zend-expressive-authentication/src/UserRepository/Htpasswd.php”,
“line”: 66,
“trace”: [
{
“file”: “/var/www/vendor/zendframework/zend-expressive-authentication/src/UserRepository/Htpasswd.php”,
“line”: 66,
“function”: “Zend\ProblemDetails\{closure}”,
“class”: “Zend\ProblemDetails\ProblemDetailsMiddleware”,
“type”: “->”,
“args”: [
8,
“Undefined offset: 1”,
“/var/www/vendor/zendframework/zend-expressive-authentication/src/UserRepository/Htpasswd.php”,
66,
{
“credential”: “testx”,
“password”: “test”,
“handle”: “Resource id #6 of type stream”,
“found”: false,
“line”: “\n”,
“name”: “\n”,
“hash”: “$2y$05$…”
}
]
},

How can I capture that exception to send you a message?