Hi All,
I wanted to direct the errors that will occur in the sample code below to a procedure. If an error occurs, the message comes, but I want to learn from which procedure it comes from. I can write the procedure information manually in the message to be sent, this way it will work for me.
var
permisson_errors:Boolean=true;
.....
procedure TForm_Main.P_action_errors(Const msg:String);
begin
showmessage(msg); // or add memo
end;
procedure Button_Example_Z_Data_Add;
begin
....
try
DataModule1.ZQuery_CRecord.Sql.Clear;
.....
DataModule1.ZQuery_CRecord.execSQL;
except
on E: EDatabaseError do if permisson_errors then P_action_errors( 'Database error: '+ E.ClassName + #13#10 + E.Message );
on E: Exception do if permisson_errors then P_action_errors( 'Error: '+ E.ClassName + #13#10 + E.Message );
end;
....
end;
procedure Button_Example_M_Data_Add;
begin
....
try
DataModule1.ZQuery_CRecord.Sql.Clear;
.....
DataModule1.ZQuery_CRecord.execSQL;
except
on E: EDatabaseError do if permisson_errors then P_action_errors( 'Database error: '+ E.ClassName + #13#10 + E.Message );
on E: Exception do if permisson_errors then P_action_errors( 'Error: '+ E.ClassName + #13#10 + E.Message );
end;
....
end;
But ; I wanted to ask in order to learn something new.
Do procedures have similar methods like self or this ?
Respects.