I still confused how to handle database violation error. Is this code give best possible error handling? Or any other way to handle error, which also make user clear about why error happen?

```
procedure TForm2.cxButton1Click(Sender: TObject);
var
  sp:TADOStoredProc;
  errorMsg : string;
begin
  //
  sp := TADOStoredProc.Create(nil);
  try
    sp.Connection := FOrm1.ADOConnection1;
    sp.ProcedureName := 'cfg.AddConfiguration';
    sp.Parameters.CreateParameter('@RETURN_VALUE', TFieldType.ftInteger, pdReturnValue, 0, 0);
    sp.Parameters.CreateParameter('@key', ftString, pdInput, 50, cxTextEdit1.Text);
    sp.Parameters.CreateParameter('@caption', ftString, pdInput, 50, cxTextEdit2.Text);
    sp.Parameters.CreateParameter('@datatype', ftString, pdInput, 50, cxComboBox1.Text);
    sp.Parameters.CreateParameter('@description', ftString, pdInput, 4000, cxMemo1.Text);
    try
      sp.ExecProc;
    except
      on e:EOleException do
      begin
        errorMsg := 'Failed to add new configuration.';
        if e.ErrorCode = 2601 then
        begin
          errorMsg := errorMsg + sLineBreak + 'Possible duplicate in key!';
        end;
        MessageDlg(errorMsg, mtError, [mbOK], 0);
      end;
    end;
  finally
    sp.Free;
  end;
end;

```