File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313#
1414# Created: 7/9/2020
1515#
16- # Updated: 12/14 /2021
16+ # Updated: 12/23 /2021
1717# -------------------------------------------------------------------------------
1818
1919# import modules
123123 # add message
124124 log_message += '\n Copied data from "{}" to "{}"\n ' .format (in_gdb , out_gdb )
125125# If an error occurs running geoprocessing tool(s) capture error and write message
126- # handle error outside of Python system
127- except EnvironmentError as e :
128- tbE = sys .exc_info ()[2 ]
129- # add the line number the error occured to the log message
130- log_message += "\n Failed at Line {}\n " .format (tbE .tb_lineno )
131- # add the error message to the log message
132- log_message += "\n Error: {}\n " .format (e )
133- # handle exception error
134- except Exception as e :
135- # Store information about the error
126+ except (Exception , EnvironmentError ) as e :
136127 tbE = sys .exc_info ()[2 ]
137128 # add the line number the error occured to the log message
138129 log_message += "\n Failed at Line {}\n " .format (tbE .tb_lineno )
Original file line number Diff line number Diff line change 1616#
1717# Created: 9/11/2020
1818#
19- # Updated: 12/14 /2021
19+ # Updated: 12/23 /2021
2020#
2121# Author: Patrick McKinney
2222# --------------------------------------------------------------------------------------------------------------------------------------------
142142 log_message += "\n Overwrote 'Some Dataset' feature service to ArcGIS Online in {}-minutes on {}\n " .format (
143143 elapsed_time_minutes , formatted_date_today )
144144# If an error occurs running geoprocessing tool(s) capture error and write message
145- # handle error outside of Python system
146- except EnvironmentError as e :
145+ except (Exception , EnvironmentError ) as e :
147146 tbE = sys .exc_info ()[2 ]
148147 # Write the line number the error occured to the log file
149148 log_message += "\n Failed at Line {}\n " .format (tbE .tb_lineno )
150149 # Write the error message to the log file
151150 log_message += "Error: {}" .format (str (e ))
152- # handle exception error
153- except Exception as e :
154- # Store information about the error
155- tbE = sys .exc_info ()[2 ]
156- # Write the line number the error occured to the log file
157- log_message += "\n Failed at Line {}\n " .format (tbE .tb_lineno )
158- # Write the error message to the log file
159- log_message += "Error: {}" .format (e )
160151finally :
161152 # write message to log file
162153 try :
Original file line number Diff line number Diff line change 77#
88# Created: 9/2/2020
99#
10- # Updated: 12/14 /2021
10+ # Updated: 12/23 /2021
1111# -------------------------------------------------------------------------------------------------------------------
1212
1313# Import system modules
143143 service_name , elapsed_time_hours , formatted_date_today )
144144# If an error occurs running geoprocessing tool(s) capture error and write message
145145# handle error outside of Python system
146- except EnvironmentError as e :
146+ except ( Exception , EnvironmentError ) as e :
147147 tbE = sys .exc_info ()[2 ]
148148 # Write the line number the error occured to the log file
149149 log_message += '\n Failed at Line {}\n ' .format (tbE .tb_lineno )
150150 # Write the error message to the log file
151151 log_message += 'Error: {}' .format (str (e ))
152- # handle exception error
153- except Exception as e :
154- # Store information about the error
155- tbE = sys .exc_info ()[2 ]
156- # Write the line number the error occured to the log file
157- log_message += '\n Failed at Line {}\n ' .format (tbE .tb_lineno )
158- # Write the error message to the log file
159- log_message += 'Error: {}' .format (e )
160152finally :
161153 # write message to log file
162154 try :
You can’t perform that action at this time.
0 commit comments