Hide the full filesystem path from error debug

On stackoverflow, I asked a question about a way to hide filesystem path from error messages in Yii2 and I did not receive any answer. However, I find an answer by using customized ErrorHandler class inherited from the original ErrorHandler. The solution is the answer of the regarded question link above.