fix testing deprecation messages
fix testing deprecation messages

* always restore the previous error handler
* throw `LogicExcetion` when unexpected error type is triggered

gencer/Yaml,symfony/yaml,symfony/Yaml