reply sent from a separated function
send a proper error if the status is not OK