Improve error reporting.

This commit is contained in:
Darko Poljak 2018-04-17 11:15:28 +02:00
commit f09765a03a
5 changed files with 68 additions and 29 deletions

View file

@ -343,10 +343,8 @@ class Remote(object):
util.log_std_fd(self.log, command, stdout, 'Remote stdout')
return output
except subprocess.CalledProcessError as e:
util.handle_called_process_error(e, command)
except OSError as error:
raise cdist.Error(" ".join(command) + ": " + error.args[1])
except (OSError, subprocess.CalledProcessError) as error:
raise cdist.Error(" ".join(command) + ": " + str(error.args[1]))
except UnicodeDecodeError:
raise DecodeError(command)
finally: