Could you change this function to return a success flag?  That way we can make the caller show a dialog for failure later.  There doesn't seem to be a need for two variables though.