PLD: check deployment exists and refactor error exit