buffer catches xdebug

using an output buffer to catch any errors, specifically from xdebug. if any output has been made prior to the final return, an error object is returned instead with the buffer.