Parsoid currently either throws an exception or does a log('fatal', ...) when it encounters a problem, including when it hits resource limits.
This is converted into an http 413 response.
Parser.php instead returns an indication of whether the limit has been reached, and when it has been the caller is expected to output an error into the HTML (and not do whatever expensive work would have been done) while still allowing the other content on the page to be displayed. That usually gives a somewhat more graceful degradation.
We should reconcile these error-handling strategies at some point (likely after the initial PHP port).
This is a task spun off from I7fce88e487d86db81748af13898fbe9d9c7cf87c.