Catching errors and painting them on screen