Skip to content

Instantly share code, notes, and snippets.

@Papierkorb
Created September 29, 2015 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Papierkorb/8760197afbe7cb0e6773 to your computer and use it in GitHub Desktop.
Save Papierkorb/8760197afbe7cb0e6773 to your computer and use it in GitHub Desktop.
def move_file_to_temporary_path(file_object, user)
temp_path = temporary_file_path(user.id)
logger.info "Storing file for #{user.id} at #{temp_path}"
FileUtils.mv file_object.path, temp_path
temp_path
rescue SystemCallError => err # Catch all Errno:: errors
logger.error "Failed to store file for #{user.id}: #{err.message}"
logger.error err.backtrace.join "\n"
raise InternalError, "Data storage error"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment