handle errors from backend