diff --git a/python/lib/dependabot/python/update_checker/pip_compile_version_resolver.rb b/python/lib/dependabot/python/update_checker/pip_compile_version_resolver.rb index 8efd0ee1e9..defb7804bb 100644 --- a/python/lib/dependabot/python/update_checker/pip_compile_version_resolver.rb +++ b/python/lib/dependabot/python/update_checker/pip_compile_version_resolver.rb @@ -173,6 +173,10 @@ def handle_pip_compile_errors(error) raise GitDependenciesNotReachable, url end + raise Dependabot::OutOfDisk if error.message.end_with?("[Errno 28] No space left on device") + + raise Dependabot::OutOfMemory if error.message.end_with?("MemoryError") + raise end # rubocop:enable Metrics/AbcSize diff --git a/python/spec/dependabot/python/update_checker/pip_compile_version_resolver_spec.rb b/python/spec/dependabot/python/update_checker/pip_compile_version_resolver_spec.rb index 531a4f3d34..066b5fc989 100644 --- a/python/spec/dependabot/python/update_checker/pip_compile_version_resolver_spec.rb +++ b/python/spec/dependabot/python/update_checker/pip_compile_version_resolver_spec.rb @@ -387,5 +387,43 @@ end end end + + context "that fails to resolve due to resource limits" do + context "because it ran out of disk space" do + before do + allow(Dependabot::SharedHelpers). + to receive(:run_shell_command). + and_raise( + Dependabot::SharedHelpers::HelperSubprocessFailed.new( + message: "OSError: [Errno 28] No space left on device", + error_context: {} + ) + ) + end + + it "raises a helpful error" do + expect { subject }. + to raise_error(Dependabot::OutOfDisk) + end + end + + context "because it ran out of memory" do + before do + allow(Dependabot::SharedHelpers). + to receive(:run_shell_command). + and_raise( + Dependabot::SharedHelpers::HelperSubprocessFailed.new( + message: "MemoryError", + error_context: {} + ) + ) + end + + it "raises a helpful error" do + expect { subject }. + to raise_error(Dependabot::OutOfMemory) + end + end + end end end