mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 01:59:12 +02:00
IDE: try to convert exception message from debugger to UTF8, if it contains invalid UTF8 chars (issue #13096)
git-svn-id: trunk@18534 -
This commit is contained in:
parent
e8466521ad
commit
a9eb4a743b
@ -1241,7 +1241,9 @@ end;
|
|||||||
|
|
||||||
procedure TDebugManager.DebuggerException(Sender: TObject; const AExceptionClass, AExceptionText: String);
|
procedure TDebugManager.DebuggerException(Sender: TObject; const AExceptionClass, AExceptionText: String);
|
||||||
var
|
var
|
||||||
|
ExceptMsg: string;
|
||||||
msg: String;
|
msg: String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if Destroying then exit;
|
if Destroying then exit;
|
||||||
|
|
||||||
@ -1249,9 +1251,15 @@ begin
|
|||||||
then
|
then
|
||||||
msg := Format('Project %s raised exception class ''%s''.',
|
msg := Format('Project %s raised exception class ''%s''.',
|
||||||
[Project1.Title, AExceptionClass])
|
[Project1.Title, AExceptionClass])
|
||||||
else
|
else begin
|
||||||
|
ExceptMsg := AExceptionText;
|
||||||
|
// if AExceptionText is not a valid UTF8 string,
|
||||||
|
// then assume it has the ansi encoding and convert it
|
||||||
|
if FindInvalidUTF8Character(pchar(ExceptMsg),length(ExceptMsg), False) > 0 then
|
||||||
|
ExceptMsg := AnsiToUtf8(ExceptMsg);
|
||||||
msg := Format('Project %s raised exception class ''%s'' with message:%s%s',
|
msg := Format('Project %s raised exception class ''%s'' with message:%s%s',
|
||||||
[Project1.Title, AExceptionClass, #13, AExceptionText]);
|
[Project1.Title, AExceptionClass, #13, ExceptMsg]);
|
||||||
|
end;
|
||||||
|
|
||||||
MessageDlg('Error', msg, mtError,[mbOk],0);
|
MessageDlg('Error', msg, mtError,[mbOk],0);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user