First of all you can do a simple IF check like
if (mysql_affected_rows($db) != 1) {
exit;
}
// other logic here

Secondly, the best way to build modules like black boxes. You pass some inputs it produces an output. Now it is up to a developer to decide where to make the safe guards - on output or inputs. With all possible issues and cases when errors are thrown it is a safer way to do safe guarding on inputs. Basically any module expects inputs and you do checks on them before you do any action. Of course it is always a balance for how much of checks we need to add into the code not to affect performance and readability.I say make your own call here but better make module which reads the response more robust to run smoothly even if PHP code has errors and some junk data was spit out.