mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: improve error and exception logging on macOS
(cherry picked from commit 54d6fd516b)
This commit is contained in:
parent
82ed95dc78
commit
7e0bede37d
3 changed files with 9 additions and 11 deletions
|
|
@ -8,7 +8,6 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
uDebug, uLog,
|
||||
MacOSAll, CocoaAll, Cocoa_Extra, CocoaUtils,
|
||||
uDarwinUtil;
|
||||
|
||||
|
|
@ -98,14 +97,9 @@ begin
|
|||
end;
|
||||
|
||||
procedure TUnmountManager.onComplete( error: NSError ); cdecl;
|
||||
var
|
||||
msg: String;
|
||||
begin
|
||||
if Assigned(error) then begin
|
||||
msg:= 'there is an error in TUnmountManager when unmount: ' + error.localizedDescription.UTF8String;
|
||||
DCDebug( msg );
|
||||
LogWrite( msg , lmtError );
|
||||
end;
|
||||
if Assigned(error) then
|
||||
logDarwinError( 'TUnmountManager error when unmount', error );
|
||||
self.Free;
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ interface
|
|||
uses
|
||||
Classes, SysUtils, LCLType,
|
||||
sqldb, SQLite3Conn, syncobjs,
|
||||
uLog, uDebug,
|
||||
MacOSAll, CocoaAll, CocoaConst, CocoaUtils, Cocoa_Extra,
|
||||
uDarwinFile, uDarwinUtil;
|
||||
|
||||
|
|
@ -500,8 +499,7 @@ begin
|
|||
except
|
||||
// it is suitable for just recording exception and handling it silently
|
||||
on e: Exception do begin
|
||||
DCDebug( 'Exception in uDarwinFinderUtil.getAllTags(): ', e.ToString );
|
||||
LogWrite( 'Exception in uDarwinFinderUtil.getAllTags(): ' + e.ToString, lmtError );
|
||||
logDarwinException( 'uDarwinFinderUtil.getAllTags()', e );
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ function NSArrayToList(const theArray:NSArray): TStringList;
|
|||
function ListToNSArray(const list:TStrings): NSArray;
|
||||
function ListToNSUrlArray(const list:TStrings): NSArray;
|
||||
procedure logDarwinError(const tag: String; const error: NSError);
|
||||
procedure logDarwinException(const tag: String; const e: Exception);
|
||||
|
||||
implementation
|
||||
|
||||
|
|
@ -75,6 +76,11 @@ begin
|
|||
LogWrite( tag + ': ' + error.description.utf8String, lmtError );
|
||||
end;
|
||||
|
||||
procedure logDarwinException(const tag: String; const e: Exception);
|
||||
begin
|
||||
LogWrite( tag + ': ' + e.ToString, lmtError );
|
||||
end;
|
||||
|
||||
function CFStringToStr(AString: CFStringRef): String;
|
||||
var
|
||||
Str: Pointer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue