Please do not return before the end of the function. Maybe you can use something like 'if badcase then errormessage else change status'. So the return at the end of the function will still be used.