I have on top of my code the line
This displays unstyled text. Is it possible to catch all errors that are displayed with error_reporting(E_ALL) via throw try block and then display those errors inside desired place?
You might find set_error_handler useful. Errors and exceptions are separate things.