From 821c83bf0049f550fc24285471e20644c973107c Mon Sep 17 00:00:00 2001
From: Lee Peuker <lee.peuker@protonmail.com>
Date: Wed, 17 Aug 2022 18:35:04 +0200
Subject: [PATCH] Fix user cli update command handling of not existing user ids

---
 src/Command/UserUpdate.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/Command/UserUpdate.php b/src/Command/UserUpdate.php
index ebb78c84..3153fc59 100644
--- a/src/Command/UserUpdate.php
+++ b/src/Command/UserUpdate.php
@@ -43,6 +43,14 @@ protected function execute(InputInterface $input, OutputInterface $output) : int
     {
         $userId = (int)$input->getArgument('userId');
 
+        try {
+            $this->userApi->fetchUser($userId);
+        } catch (\RuntimeException $e) {
+            $this->generateOutput($output, 'User id does not exist: ' . $userId);
+
+            return Command::FAILURE;
+        }
+
         try {
             $email = $input->getOption('email');
             if ($email !== null) {