commit/galaxy-central: dan: Some better error handling for external display applications when e.g. files have been deleted but are still active in applications.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/76ad26875b62/ Changeset: 76ad26875b62 User: dan Date: 2014-04-17 21:05:18 Summary: Some better error handling for external display applications when e.g. files have been deleted but are still active in applications. Affected #: 1 file diff -r c4291f95313abcb1ad91ffe4faaa2c30b05149dc -r 76ad26875b62c8ff3257b845df86a5864f0d1c91 lib/galaxy/webapps/galaxy/controllers/dataset.py --- a/lib/galaxy/webapps/galaxy/controllers/dataset.py +++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py @@ -686,10 +686,19 @@ msg = [] refresh = False display_app = trans.app.datatypes_registry.display_applications.get( app_name ) - assert display_app, "Unknown display application has been requested: %s" % app_name + if not display_app: + log.debug( "Unknown display application has been requested: %s", app_name ) + return paste.httpexceptions.HTTPNotFound( "The requested display application (%s) is not available." % ( app_name ) ) dataset_hash, user_hash = encode_dataset_user( trans, data, user ) - display_link = display_app.get_link( link_name, data, dataset_hash, user_hash, trans, app_kwds ) - assert display_link, "Unknown display link has been requested: %s" % link_name + try: + display_link = display_app.get_link( link_name, data, dataset_hash, user_hash, trans, app_kwds ) + except Exception, e: + log.debug( "Error generating display_link: %s", e ) + # User can sometimes recover from, e.g. conversion errors by fixing input metadata, so use conflict + return paste.httpexceptions.HTTPConflict( "Error generating display_link: %s" % e ) + if not display_link: + log.debug( "Unknown display link has been requested: %s", link_name ) + return paste.httpexceptions.HTTPNotFound( "Unknown display link has been requested: %s" % link_name ) if data.state == data.states.ERROR: msg.append( ( 'This dataset is in an error state, you cannot view it at an external display application.', 'error' ) ) elif data.deleted: @@ -715,8 +724,12 @@ assert value, "An invalid parameter name was provided: %s" % action_param assert value.parameter.viewable, "This parameter is not viewable." if value.parameter.type == 'data': - content_length = os.path.getsize( value.file_name ) - rval = open( value.file_name ) + try: + content_length = os.path.getsize( value.file_name ) + rval = open( value.file_name ) + except OSError, e: + log.debug( "Unable to access requested file in display application: %s", e ) + return paste.httpexceptions.HTTPNotFound( "This file is no longer available." ) else: rval = str( value ) content_length = len( rval ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org