Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[chore] remove rescue and reraise of internal errors

Eric Schubertfea9dc8048b4
diff --git a/modules/storages/lib/api/v3/file_links/work_packages_file_links_api.rb b/modules/storages/lib/api/v3/file_links/work_packages_file_links_api.rb
index 066b79ca75f..9102c618cd9 100644
--- a/modules/storages/lib/api/v3/file_links/work_packages_file_links_api.rb
+++ b/modules/storages/lib/api/v3/file_links/work_packages_file_links_api.rb
@@ -55,29 +55,21 @@ module API
end
# Get a (potentially huge...) list of all FileLinks for the work package.
- file_links = query
- .results
- .where(id: visible_file_links_scope
- .where(container_id: @work_package.id, container_type: 'WorkPackage'))
- .all
+ file_links = query.results
+ .where(id: visible_file_links_scope
+ .where(container_id: @work_package.id, container_type: 'WorkPackage'))
- begin
- # Synchronize with Nextcloud. StorageAPI has handled OAuth2 for us before.
- # We ignore the result, because partial errors (storage network issues) are written to each FileLink
- service_result = ::Storages::FileLinkSyncService
- .new(user: current_user)
- .call(file_links)
+ # Synchronize with Nextcloud. StorageAPI has handled OAuth2 for us before.
+ # We ignore the result, because partial errors (storage network issues) are written to each FileLink
+ service_result = ::Storages::FileLinkSyncService
+ .new(user: current_user)
+ .call(file_links)
- ::API::V3::FileLinks::FileLinkCollectionRepresenter.new(
- service_result.result,
- self_link: api_v3_paths.file_links(@work_package.id),
- current_user:
- )
- rescue StandardError => e
- # Example case: invalid oauth_client for storage raises invalid operation => 500
- message = "#{I18n.t('api_v3.errors.code_500')}: #{e.message}"
- raise ::API::Errors::InternalError.new(message)
- end
+ ::API::V3::FileLinks::FileLinkCollectionRepresenter.new(
+ service_result.result,
+ self_link: api_v3_paths.file_links(@work_package.id),
+ current_user:
+ )
end
post &CreateEndpoint