Ok so again my question is kind of a best practices/techniques question so I'm assuming there will be a few different ways to handle this.
So, to what degree should I factor in error handling? As an example, say I havee a basic function in my model which retrieves a customers record ie
function get_customer($customer_id) {
$this->where('id',$customer_id);
$query = $this->db->get('customers');
return $query->result();
}
Should I put in something to check whether the parameter $customer_id, exists and is the correct type? or does it depend on the logic of the application? For instance, in some cases this function would never be called unless $customer_id is set and that might be checked in the controller, but is it best practice to include the error checking here as well?
Also, should I use something like try/catch and throw an exception or can it just be as simple as if ($customer_id!='') etc ?