Smart pascal source code
procedure ThisOneBombs;
begin
raise Exception.Create('boom!');
end;
procedure CallsABomb;
begin
ThisOneBombs;
end;
try
raise Exception.Create('booh');
except
on E: Exception do
begin
WriteLn(E.Message);
WriteLn(E.StackTrace);
end;
end;
try
ThisOneBombs;
except
on E: Exception do
begin
WriteLn(E.Message);
WriteLn(E.StackTrace);
end;
end;
try
CallsABomb;
except
on E: Exception do
begin
WriteLn(E.Message);
WriteLn(E.StackTrace);
end;
end;
type
TMyClass = class
procedure Boom;
end;
procedure TMyClass.Boom;
begin
raise Exception.Create('class boom');
end;
try
var c := TMyClass.Create;
c.Boom;
except
on E: Exception do
begin
WriteLn(E.Message);
WriteLn(E.StackTrace);
end;
end;
{<<< RESULT - CONSOLE LOG >>>
-----------------------------
booh
[line: 13, column: 20]
boom!
ThisOneBombs [line: 3, column: 20]
[line: 22, column: 4]
boom!
ThisOneBombs [line: 3, column: 20]
CallsABomb [line: 8, column: 4]
[line: 31, column: 4]
class boom
TMyClass.Boom [line: 46, column: 20]
[line: 51, column: 6]
-----------------------------
{<<<<<<<<< THE END >>>>>>>>>}