Skip to content

Commit

Permalink
fix: storage error passing
Browse files Browse the repository at this point in the history
  • Loading branch information
mjaquiery committed Jun 25, 2024
1 parent 36eb56d commit a2e7991
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion backend_django/config/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# Build paths inside the project like this: BASE_DIR / 'subdir'.
import os

API_VERSION = "2.1.48"
API_VERSION = "2.1.49"

try:
USER_ACTIVATION_TOKEN_EXPIRY_S = int(os.environ.get("DJANGO_USER_ACTIVATION_TOKEN_EXPIRY_S"))
Expand Down
20 changes: 11 additions & 9 deletions backend_django/galv/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,8 @@ def handle_file_size_report(harvester, path, monitored_path, content):
path=path,
bytes_required=settings.MAX_PNG_PREVIEW_SIZE
)
except StorageError as e:
return error_response(f"Error creating File: {e}", status=507)
except Exception as e:
return error_response(f"Error creating File: {e}")
file.monitored_paths.add(monitored_path)
Expand Down Expand Up @@ -977,20 +979,20 @@ def handle_upload_parquets(file, data, request):
partition.delete()
except ParquetPartition.DoesNotExist:
pass
try:
partition = ParquetPartition.objects.create(
observed_file=file,
partition_number=data['partition_number'],
bytes_required=upload.size
)
except Exception as e:
return error_response(f"Error creating ParquetPartition: {e}")

partition = ParquetPartition.objects.create(
observed_file=file,
partition_number=data['partition_number'],
bytes_required=upload.size
)
partition.parquet_file = upload
partition.save()
except StorageError as e:
file.state = FileState.AWAITING_STORAGE
file.save()
return error_response(f"Error uploading file to storage: {e}", status=507)
return error_response(f"Error uploading parquet file to storage: {e}", status=507)
except Exception as e:
return error_response(f"Error creating Parquet Partition: {e}")
return Response(ParquetPartitionSerializer(partition, context={'request': request}).data)

def handle_upload_complete(file, data):
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
project = 'Galv'
copyright = '2023, Oxford RSE'
author = 'Oxford RSE'
release = '2.1.48'
release = '2.1.49'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion docs/tags.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["v2.1.48","main"]
["v2.1.49","main"]

0 comments on commit a2e7991

Please sign in to comment.