Skip to content

Commit

Permalink
exception handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Meiklejohn committed Mar 23, 2010
1 parent e0d5be9 commit 6393543
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/aws_workers/s3/synchronize_asset_between_buckets_task.rb
Expand Up @@ -40,11 +40,18 @@ def execute
@source_bucket = @s3.bucket(@source_bucket_name)
@destination_bucket = @s3.bucket(@destination_bucket_name)

if !@source_bucket
raise "Source bucket does not exist."
end

if !@destination_bucket
raise "Destination bucket does not exist."
end

@logger.debug("AwsWorkers::S3::SynchronizeAssetBetweenBucketsTask.execute " +
"source bucket accessed #{source_bucket_name}") if @source_bucket
@logger.debug("AwsWorkers::S3::SynchronizeAssetBetweenBucketsTask.execute " +
"destination bucket accessed #{destination_bucket_name}")


# Get source key
source_key = RightAws::S3::Key.create(@source_bucket,
Expand All @@ -59,6 +66,10 @@ def execute
destination_key = RightAws::S3::Key.create(@destination_bucket,
source_key.to_s)

if !source_key.exists?
raise "Source file not found."
end

# If it exists...
if destination_key.exists? and source_key.exists?

Expand Down

0 comments on commit 6393543

Please sign in to comment.