GithubHelp home page GithubHelp logo

Comments (5)

asafgabai avatar asafgabai commented on July 17, 2024 2

Hi @malkam03 and @alex1989hu
After some investigation we noticed that this issue occurs only for HTTP errors returned from Artifactory.
Golang's HTTP client doesn't return an error for non-2xx responses, so jfrog-client-go will have to check the response's status code and throw an error accordingly.
To make these errors easier to handle, they will be of a new struct containing the status code, status definition and maybe some more useful information.
Pay attention that only the first error to be thrown is returned from the method, even if more than one error was thrown throughout the process.
Nowadays I'm working on a cool new feature of archiving and uploading files to Artifactory, so I'll start implementing this solution in the next few days.
Meanwhile I'll be happy to hear your thoughts about it.

from jfrog-client-go.

yahavi avatar yahavi commented on July 17, 2024 2

@malkam03 @alex1989hu,
Thanks for reporting this issue.
This is resolved in 0.22.0 at https://github.com/jfrog/jfrog-client-go/pull/340/files#diff-fbe1867fd4ced5fcc9f3fd0a019edb80095566953e286e5e41e46439310ce228R437

However, I'd recommend upgrading to the latest version v1.10.0 to get better logging and a retry mechanism.

Please let me know if that helped.

from jfrog-client-go.

eyalbe4 avatar eyalbe4 commented on July 17, 2024 1

Thanks for reporting this issue!
We're looking into it now.

from jfrog-client-go.

alex1989hu avatar alex1989hu commented on July 17, 2024

Hello, I also met this issue today - started to use the library few days ago to let me able to upload files.

/cc @eyalbe4 Is it a possible solution?

diff --git a/artifactory/services/upload.go b/artifactory/services/upload.go
index 7034b12..5fe09c5 100644
--- a/artifactory/services/upload.go
+++ b/artifactory/services/upload.go
@@ -1,6 +1,7 @@
 package services

 import (
+       "errors"
        "net/http"
        "os"
        "path/filepath"
@@ -88,7 +89,9 @@ func (us *UploadService) performUploadTasks(consumer parallel.Runner, uploadSumm
        log.Debug("Uploaded", strconv.Itoa(totalUploaded), "artifacts.")
        totalFailed = totalUploadAttempted - totalUploaded
        if totalFailed > 0 {
-               log.Error("Failed uploading", strconv.Itoa(totalFailed), "artifacts.")
+               errFailed := errorutils.CheckError(errors.New("Failed uploading" + strconv.Itoa(totalFailed) + "artifacts"))
+               errorsQueue.AddError(errFailed)
+               log.Error(errFailed)
        }
        err = errorsQueue.GetError()
        return

from jfrog-client-go.

alex1989hu avatar alex1989hu commented on July 17, 2024

cool new feature of archiving and uploading files to Artifactory, so I'll start implementing this solution in the next few days

Hello @asafgabai, I am happy that you checked what happens inside. I think throwing the first error only is much better, than the current behaviour which ignores - due to Go HTTP Client as you wrote - a set of ~errors.

from jfrog-client-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.