mirror of https://gitlab.com/basile.b/dexed.git
enhance simpleGet failure messages
This commit is contained in:
parent
ebcbd9cf5d
commit
a4d3dbed7f
|
@ -338,7 +338,7 @@ begin
|
||||||
if assigned(fList) then
|
if assigned(fList) then
|
||||||
fillList
|
fillList
|
||||||
else
|
else
|
||||||
dlgOkError('could not get the package list, check you connection or that curl library is setup');
|
dlgOkError('could not get the package list, ' + simpleGetErrMsg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDubPackageQueryForm.fillList;
|
procedure TDubPackageQueryForm.fillList;
|
||||||
|
|
|
@ -2035,7 +2035,7 @@ begin
|
||||||
res.free;
|
res.free;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
else dlgOkError('Impossible to check new versions, no connectivity or lib CURL not installed');
|
else dlgOkError('Impossible to check new versions, ' + simpleGetErrMsg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.DoFirstShow;
|
procedure TMainForm.DoFirstShow;
|
||||||
|
|
|
@ -10,13 +10,19 @@ uses
|
||||||
type
|
type
|
||||||
PStream = ^TStream;
|
PStream = ^TStream;
|
||||||
|
|
||||||
// Get the content of url in the string data
|
// Get the content of 'url' in the string 'data'
|
||||||
function simpleGet(url: string; var data: string): boolean; overload;
|
function simpleGet(url: string; var data: string): boolean; overload;
|
||||||
// Get the content of url in the stream data
|
// Get the content of 'url' in the stream 'data'
|
||||||
function simpleGet(url: string; data: TStream): boolean; overload;
|
function simpleGet(url: string; data: TStream): boolean; overload;
|
||||||
// Get the content of url in the JSON data, supposed to be a nil instance.
|
// Get the content of 'url' in the JSON 'data', supposed to be a nil instance.
|
||||||
function simpleGet(url: string; var data: TJSONData): boolean; overload;
|
function simpleGet(url: string; var data: TJSONData): boolean; overload;
|
||||||
|
|
||||||
|
const
|
||||||
|
{$ifdef windows} libcurlFname = 'libcurl.dll'; {$endif}
|
||||||
|
{$ifdef linux} libcurlFname = 'libcurl.so'; {$endif}
|
||||||
|
{$ifdef darwin} libcurlFname = 'libcurl.dylib'; {$endif}
|
||||||
|
simpleGetErrMsg = 'no network or ' + libcurlFname + ' not setup correctly';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -35,7 +41,6 @@ end;
|
||||||
function simpleGetClbckForStream(buffer:Pchar; size:PtrInt; nitems:PtrInt;
|
function simpleGetClbckForStream(buffer:Pchar; size:PtrInt; nitems:PtrInt;
|
||||||
appender: PStream): PtrInt; cdecl;
|
appender: PStream): PtrInt; cdecl;
|
||||||
begin
|
begin
|
||||||
assert(appender <> nil);
|
|
||||||
try
|
try
|
||||||
result := appender^.write(buffer^, size * nitems);
|
result := appender^.write(buffer^, size * nitems);
|
||||||
except
|
except
|
||||||
|
@ -46,7 +51,6 @@ end;
|
||||||
function simpleGetClbckForString(buffer:Pchar; size:PtrInt; nitems:PtrInt;
|
function simpleGetClbckForString(buffer:Pchar; size:PtrInt; nitems:PtrInt;
|
||||||
appender: PString): PtrInt; cdecl;
|
appender: PString): PtrInt; cdecl;
|
||||||
begin
|
begin
|
||||||
assert(appender <> nil);
|
|
||||||
result := size* nitems;
|
result := size* nitems;
|
||||||
try
|
try
|
||||||
(appender^) += buffer;
|
(appender^) += buffer;
|
||||||
|
|
Loading…
Reference in New Issue