Skip to content

Commit

Permalink
Add error handling when saving files directly to S3 (#3021)
Browse files Browse the repository at this point in the history
  • Loading branch information
hackdna authored and scottx611x committed Oct 12, 2018
1 parent 2c29b54 commit 4e8823b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions refinery/data_set_manager/isa_tab_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

from django.core.files import File

from file_store.models import FileStoreItem
import botocore

from file_store.models import FileStoreItem
from .models import (Assay, Attribute, Contact, Design, Factor, Investigation,
Node, Ontology, Protocol, ProtocolReference,
ProtocolReferenceParameter, Publication, Study)
Expand Down Expand Up @@ -1019,7 +1020,8 @@ def run(self, path, isa_archive=None, preisa_archive=None):
file_store_item.datafile.save(
os.path.basename(isa_archive), File(isa_archive_obj)
)
except EnvironmentError as exc:
except (EnvironmentError, botocore.exceptions.ClientError,
botocore.exceptions.ParamValidationError) as exc:
logger.error(
"Failed to save ISA archive '%s' to file store: %s",
isa_archive, exc
Expand All @@ -1035,7 +1037,8 @@ def run(self, path, isa_archive=None, preisa_archive=None):
file_store_item.datafile.save(
os.path.basename(isa_archive), File(preisa_archive_obj)
)
except EnvironmentError as exc:
except (EnvironmentError, botocore.exceptions.ClientError,
botocore.exceptions.ParamValidationError) as exc:
logger.error(
"Failed to save pre ISA archive '%s' to file store: %s",
preisa_archive, exc
Expand Down

0 comments on commit 4e8823b

Please sign in to comment.