cbson: simplify error handling.