ifdherror.py
Go to the documentation of this file.
1 #! /usr/bin/env python
2 ######################################################################
3 #
4 # Name: ifdherror.py
5 #
6 # Purpose: Python class IFDHError (exception class). This class captures
7 # the error status related to ifdh commands that return nonzero
8 # exit statuses. This exception would normally be raised after
9 # any failed ifdh command.
10 #
11 # This class contains four data members.
12 #
13 # command - Ifdh command (string).
14 # status - Ifdh exit status.
15 # out - Ifdh standard output.
16 # err - Ifdh diagnostic output.
17 #
18 # Created: 4-Sep-2015 Herbert Greenlee
19 #
20 ######################################################################
21 
22 from __future__ import absolute_import
23 from __future__ import print_function
24 
25 # Ifdh exception class.
26 
28 
29  def __init__(self, command, status, out, err):
30 
31  # Store command as a single string.
32  # For compatibility with subprocess module, the command may be passed
33  # as a list of words.
34 
35  self.command = ''
36  if type(command) == type([]):
37  for word in command:
38  self.command = self.command + ' ' + str(word)
39  else:
40  self.command = str(command)
41  self.status = int(status)
42  self.out = str(out)
43  self.err = str(err)
44  return
45 
46  def __str__(self):
47  s = '\nCommand: %s\nStatus: %d\nOutput: %s\nError: %s\n' % (
48  self.command, self.status, self.out, self.err)
49  return s
50 
51 
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
static QCString str
def __init__(self, command, status, out, err)
Definition: ifdherror.py:29