~xzcvczx/kicad/page-settings_datetime

« back to all changes in this revision

Viewing changes to pcbnew/github/github_plugin.cpp

  • Committer: jean-pierre charras
  • Date: 2015-12-30 08:10:39 UTC
  • mfrom: (6408.1.1 testing)
  • Revision ID: jp.charras@wanadoo.fr-20151230081039-ut7tpyetkt78032e
Github plugin with curl: fix lack of message when trying to download a non existing footprint library (Curl does not return an error: the message "Not Fount" is stored in buffer, and the zip handler returns a not suitable error message)
Minor and very minor other fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
mechanism can be found, or github gets more servers.  But note that the occasionally
39
39
slow response is the exception rather than the norm.  Normally the response is
40
40
down around a 1/3 of a second.  The information we would use is in the header
41
 
named "Last-Modified" as seen below. 
 
41
named "Last-Modified" as seen below.
42
42
 
43
43
 
44
44
HTTP/1.1 200 OK
545
545
    {
546
546
        UTF8 fmt( _( "%s\nCannot get/download Zip archive: '%s'\nfor library path: '%s'.\nReason: '%s'" ) );
547
547
 
548
 
        std::string msg = StrPrintf( fmt.c_str(), 
549
 
                                     zip_url.c_str(), 
 
548
        std::string msg = StrPrintf( fmt.c_str(),
 
549
                                     zip_url.c_str(),
550
550
                                     TO_UTF8( aRepoURL ),
551
551
                                     TO_UTF8( ioe.errorText ) );
552
552
 
553
553
        THROW_IO_ERROR( msg );
554
554
    }
 
555
 
 
556
    // If the zip archive is not existing, the received data is "Not Found",
 
557
    // and no error is returned by kcurl.Perform().
 
558
    if( m_zip_image.compare( 0, 9, "Not Found" ) == 0 )
 
559
    {
 
560
        UTF8 fmt( _( "Cannot download library '%s'.\nThe library does not exist on the server" ) );
 
561
        std::string msg = StrPrintf( fmt.c_str(), TO_UTF8( aRepoURL ) );
 
562
 
 
563
        THROW_IO_ERROR( msg );
 
564
    }
555
565
}
556
566
 
557
567
#if 0 && defined(STANDALONE)