belo Posted January 30, 2013 Share Posted January 30, 2013 How to Disable Javascript Error in browsers? To centralize errors in an application use the VCL component ApplicationEvents, example: procedure TFrmPrincipal.ApplicationEvents1Exception(Sender: TObject; E: Exception); var Mensagem: string; Pos1, Pos2: integer; begin if Pos(UpperCase('unavailable database'), UpperCase(E.Message)) <> 0 then ShowMessage('Servidor de Banco de Dados Off-Line.') else if Pos(UpperCase('is not a valid date'), UpperCase(E.Message)) <> 0 then ShowMessage('Data inválida, proceda a correção.') else if Pos(UpperCase('key violation'), UpperCase(E.Message)) <> 0 then ShowMessage('Houve violação de Chave. Registro já incluido.') else if Pos(UpperCase('Input value'), UpperCase(E.Message)) <> 0 then ShowMessage('Campo preenchido com valor não válido. Proceda a correção.') else if Pos(UpperCase('is not a valid time'), UpperCase(E.Message)) <> 0 then ShowMessage('Hora inválida, proceda a correção.') else if Pos(UpperCase('must have a value'), UpperCase(E.Message)) <> 0 then begin Pos1 := Pos('''', E.Message); Mensagem := E.Message; Delete(Mensagem, Pos1, 1); Pos2 := Pos('''', Mensagem); Mensagem := copy(E.Message, Pos1 + 1, Pos2 - Pos1); ShowMessage('É obrigatório o preenchimento do campo "' + Mensagem + '".'); end else ShowMessage(E.Message); end; How to implement this in UniGUI? Error in Opera browser.. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted January 30, 2013 Administrators Share Posted January 30, 2013 See CustomExceptions demo. Quote Link to comment Share on other sites More sharing options...
belo Posted January 30, 2013 Author Share Posted January 30, 2013 See CustomExceptions demo. Thanks Farshad! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.