We would have to update the object to work with something like this. Currently if a select statement errors it writes the error to the page, so you would never get to your echo statement. The execute function doesn't return a result, so it will always be null and therefor always echo 0 to the page when it succeeds and then error in the execute function itself when it fails.
I'm interested in your use case and could update the objects to function in the way you have supposed they would in your code example, but I'd like to understand why it might fail and understand your use case better before going through the effort. Can you provide a little background about what would cause it to fail in the first place and what types of failure you are trying to capture?