Allow function to be passed as a callback and throw error if callback has not been found