Hola quinqui!
La forma de manejar el error sería la siguiente:
Código Delphi
[-]
procedure TForm1.ZqMasterPostError(DataSet: TDataSet; E: EDatabaseError;
var Action: TDataAction);
begin
if e is EZDatabaseError then
begin
case EZDatabaseError(E).ErrorCode of
1062 : begin
Showmessage ('Ya existe una key con este número.');
end;
else
Showmessage ('Se ha producido un error al intentar guardar el registro:' +
chr(13) + chr(13) + inttostr(EZDatabaseError(E).ErrorCode) +
' -> ' + E.Message);
end;
Action := daAbort;
end;
end;
Como podrás notar, haciendo EZDatabaseError(E).ErrorCode podés obtener el código de error.
Saludos!