Strip exception strings from being included in log.exception statements across the project.

This commit is contained in:
Dannon Baker
2017-04-13 14:06:11 -04:00
parent 8599dff7a0
commit d303cf5ffb
14 changed files with 22 additions and 22 deletions
+2 -2
View File
@@ -107,14 +107,14 @@ class DeferredJobQueue( object ):
job_state = self.plugins[job.plugin].check_job( job )
except Exception as e:
self.__fail_job( job )
log.exception( 'Set deferred job %s to error because of an exception in check_job(): %s' % ( job.id, str( e ) ) )
log.exception( 'Set deferred job %s to error because of an exception in check_job()' % job.id )
continue
if job_state == self.job_states.READY:
try:
self.plugins[job.plugin].run_job( job )
except Exception as e:
self.__fail_job( job )
log.exception( 'Set deferred job %s to error because of an exception in run_job(): %s' % ( job.id, str( e ) ) )
log.exception( 'Set deferred job %s to error because of an exception in run_job()' % job.id )
continue
elif job_state == self.job_states.INVALID:
self.__fail_job( job )
+1 -1
View File
@@ -785,7 +785,7 @@ class DefaultJobDispatcher( object ):
try:
return self.job_runners[runner_name].url_to_destination(url)
except Exception as e:
log.exception("Unable to convert legacy job runner URL '%s' to job destination, destination will be the '%s' runner with no params: %s" % (url, runner_name, e))
log.exception("Unable to convert legacy job runner URL '%s' to job destination, destination will be the '%s' runner with no params" % (url, runner_name))
return JobDestination(runner=runner_name)
def put( self, job_wrapper ):
+1 -1
View File
@@ -1103,7 +1103,7 @@ class Tool( object, Dictifiable ):
try:
help_text = tool_shed.util.shed_util_common.set_image_paths( self.app, self.repository_id, help_text )
except Exception as e:
log.exception( "Exception in parse_help, so images may not be properly displayed:\n%s" % str( e ) )
log.exception( "Exception in parse_help, so images may not be properly displayed" )
try:
self.__help = Template( rst_to_html(help_text), input_encoding='utf-8',
output_encoding='utf-8', default_filters=[ 'decode.utf8' ],
+1 -1
View File
@@ -20,7 +20,7 @@ for assertion_module_name in assertion_module_names:
assertion_module = sys.modules[full_assertion_module_name]
assertion_modules.append(assertion_module)
except Exception as e:
log.exception('Failed to load assertion module: %s %s' % (assertion_module_name, str(e)))
log.exception('Failed to load assertion module: %s' % (assertion_module_name))
def verify_assertions(data, assertion_description_list):
+1 -1
View File
@@ -216,7 +216,7 @@ class Genomes( object ):
twobit_fields[ key ] = path
except IOError as e:
# Thrown if twobit.loc does not exist.
log.exception( "Error reading twobit.loc: %s", e )
log.exception( "Error reading twobit.loc" )
for key, description in self.app.genome_builds.get_genome_build_names():
self.genomes[ key ] = Genome( key, description )
# Add len files to genomes.
@@ -162,7 +162,7 @@ class HistoryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar
)
return self.__collection_dict( trans, dataset_collection_instance, view="element" )
except Exception as e:
log.exception( "Error in history API at listing dataset collection: %s", e )
log.exception( "Error in history API at listing dataset collection" )
trans.response.status = 500
return { 'error': str( e ) }
@@ -391,14 +391,14 @@ class LibraryContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrar
rval[ 'deleted' ] = True
except exceptions.httpexceptions.HTTPInternalServerError as http_server_err:
log.exception( 'Library_contents API, delete: uncaught HTTPInternalServerError: %s, %s\n%s',
id, str( kwd ), str( http_server_err ) )
log.exception( 'Library_contents API, delete: uncaught HTTPInternalServerError: %s, %s',
id, str( kwd ) )
raise
except exceptions.httpexceptions.HTTPException:
raise
except Exception as exc:
log.exception( 'library_contents API, delete: uncaught exception: %s, %s\n%s',
id, str( kwd ), str( exc ) )
log.exception( 'library_contents API, delete: uncaught exception: %s, %s',
id, str( kwd ) )
trans.response.status = 500
rval.update({ 'error': str( exc ) })
return rval
@@ -630,7 +630,7 @@ class HistoryController( BaseUIController, SharableMixin, UsesAnnotations, UsesI
except Exception as exc:
user_id = str( trans.user.id ) if trans.user else '(anonymous)'
log.exception( 'Error bootstrapping history for user %s: %s', user_id, exc )
log.exception( 'Error bootstrapping history for user %s', user_id )
if isinstance( exc, exceptions.ItemAccessibilityException ):
error_msg = 'You do not have permission to view this history.'
else:
@@ -24,7 +24,7 @@ def upgrade(migrate_engine):
PasswordResetToken_table.create()
except Exception as e:
print str(e)
log.exception("Creating %s table failed: %s" % (PasswordResetToken_table.name, str( e ) ) )
log.exception("Creating %s table failed" % PasswordResetToken_table.name )
def downgrade(migrate_engine):
@@ -34,4 +34,4 @@ def downgrade(migrate_engine):
PasswordResetToken_table.drop()
except Exception as e:
print str(e)
log.exception("Dropping %s table failed: %s" % (PasswordResetToken_table.name, str( e ) ) )
log.exception("Dropping %s table failed" % PasswordResetToken_table.name )
+2 -2
View File
@@ -451,8 +451,8 @@ class MetadataGenerator( object ):
try:
exported_workflow_dict = json.loads( workflow_text )
except Exception as e:
log.exception( "Skipping file %s since it does not seem to be a valid exported Galaxy workflow: %s"
% ( str( relative_path ), str( e ) ) )
log.exception( "Skipping file %s since it does not seem to be a valid exported Galaxy workflow"
% str( relative_path ) )
valid_exported_galaxy_workflow = False
if valid_exported_galaxy_workflow and \
'a_galaxy_workflow' in exported_workflow_dict and \
+1 -1
View File
@@ -238,7 +238,7 @@ def handle_gzip( repository, uploaded_file_name ):
except IOError as e:
os.close( fd )
os.remove( uncompressed )
log.exception( 'Problem uncompressing gz data "%s": %s' % ( uploaded_file_name, str( e ) ) )
log.exception( 'Problem uncompressing gz data "%s"' % uploaded_file_name )
return
if not chunk:
break
+3 -3
View File
@@ -178,7 +178,7 @@ def get_protocol_from_tool_shed_url( tool_shed_url ):
# We receive a lot of calls here where the tool_shed_url is None. The container_util uses
# that value when creating a header row. If the tool_shed_url is not None, we have a problem.
if tool_shed_url is not None:
log.exception( "Handled exception getting the protocol from Tool Shed URL %s:\n%s", str( tool_shed_url ), e )
log.exception( "Handled exception getting the protocol from Tool Shed URL %s", str( tool_shed_url ) )
# Default to HTTP protocol.
return 'http'
@@ -276,7 +276,7 @@ def handle_tool_shed_url_protocol( app, shed_url ):
# We receive a lot of calls here where the tool_shed_url is None. The container_util uses
# that value when creating a header row. If the tool_shed_url is not None, we have a problem.
if shed_url is not None:
log.exception( "Handled exception removing protocol from URL %s:\n%s", str( shed_url ), e )
log.exception( "Handled exception removing protocol from URL %s", str( shed_url ) )
return shed_url
@@ -317,7 +317,7 @@ def remove_port_from_tool_shed_url( tool_shed_url ):
# We receive a lot of calls here where the tool_shed_url is None. The container_util uses
# that value when creating a header row. If the tool_shed_url is not None, we have a problem.
if tool_shed_url is not None:
log.exception( "Handled exception removing the port from Tool Shed URL %s:\n%s", str( tool_shed_url ), e )
log.exception( "Handled exception removing the port from Tool Shed URL %s", str( tool_shed_url ) )
return tool_shed_url
+1 -1
View File
@@ -58,7 +58,7 @@ def build_readme_files_dict( app, repository, changeset_revision, metadata, tool
app.security.encode_id( repository.id ),
text_of_reasonable_length )
except Exception as e:
log.exception( "Exception in build_readme_files_dict, so images may not be properly displayed:\n%s" % str( e ) )
log.exception( "Exception in build_readme_files_dict, so images may not be properly displayed" )
finally:
lock.release()
if readme_file_name.endswith( '.rst' ):
+1 -1
View File
@@ -813,7 +813,7 @@ def get_tool_shed_status_for_installed_repository( app, repository ):
# The required tool shed may be unavailable, so default the revision_update value to 'false'.
return dict( revision_update='false' )
except Exception as e:
log.exception( "Error attempting to get tool shed status for installed repository %s: %s" % ( str( repository.name ), str( e ) ) )
log.exception( "Error attempting to get tool shed status for installed repository %s" % str( repository.name ) )
return {}