Acontece que muitas vezes um serviço não sobe e você simplesmente fica sem saber o que aconteceu.
Exemplo:
procedure TcsBlendedServerService.ServiceStart(Sender: TService;
var Started: Boolean);
var
bRet : Boolean;
begin
try
try
bRet := dmNucleo.StartServer;
Started := bRet;
except
on E: Exception do
begin
Started := False;
Self.GerarLog(DescreverException(E),4938403,ctLOGException,rlCritical);
end;
end;
finally
end;
end;
Caso o serviço não suba, retorna a seguinte tela de erro:
Para melhorar esta situação, a classe TService oferece o ErrCode, veja o exemplo:
procedure TcsBlendedServerService.ServiceStart(Sender: TService;
var Started: Boolean);
var
bRet : Boolean;
begin
try
try
bRet := dmNucleo.StartServer;
Started := bRet;
//Retorno de um código numérico
if not (Started) then
Self.ErrCode := 10;
//---
except
on E: Exception do
begin
Started := False;
Self.GerarLog(DescreverException(E),4938403,ctLOGException,rlCritical);
end;
end;
finally
end;
end;
Neste caso aparece a tela abaixo:
Não é lá essas coisas mas ajuda.

