#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    28
    Rep Power
    0

    Operation Aborted Exception


    In the following code, i got an access violation error, while choosing the option 'mrCancel'. The code is as follows,
    case VerifySaveChanges of
    mrYes: InvokeSave;
    mrNo: Cancel;
    mrCancel: Abort;
    end;


    By using try.. Except, i got the exception.
    Exception Name :'OPERATION ABORTED'.
    How to resolve this ?

    Thanks in advance.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    OPERATION ABORTED
    Is not an access violation, it is an exception that you raised by calling
    Abort;

    If you check the help file you will see that abort simply raises a silent exception.
    i.e. an exception that does not produce the default exception dialog.

    Clive
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    28
    Rep Power
    0
    Originally Posted by clivew
    OPERATION ABORTED
    Is not an access violation, it is an exception that you raised by calling
    Abort;

    If you check the help file you will see that abort simply raises a silent exception.
    i.e. an exception that does not produce the default exception dialog.

    Clive
    Thanks for the reply.
    Actually this particular code taken care of refreshing dataset, will execute only in two scenarios.
    scenario 1 : Pressing F5
    scenario 2 : Using shortcut key ( Ctrl + f )
    For pressing f5, its working fine as u said the 'Silent exception' occurs. In second scenario alone it returns an access violation.

    What would be the prob ?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    What would be the prob ?
    Not sure how you expect us to help if you do not post the relevant code.
    Your original post says nothing about F5 or (Ctrl + f), the code behind them or
    the context in which they are called. It only references the coded
    response of OPERATION ABORTED.

    Clive
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    28
    Rep Power
    0
    Originally Posted by clivew
    Not sure how you expect us to help if you do not post the relevant code.
    Your original post says nothing about F5 or (Ctrl + f), the code behind them or
    the context in which they are called. It only references the coded
    response of OPERATION ABORTED.

    Clive

    Sorry for the incomplete data.
    Code for Shorcut [Ctrl + F] is here as follows,
    procedure HandleMaintNext;
    begin
    MoveBy(1);
    end;

    function MoveBy(Distance: Integer): Integer;
    begin
    CheckDS;
    CheckModified;
    //
    // Additional Codes
    //
    end;

    procedure CheckModified;
    begin
    if assigned(FDM) then begin
    case VerifySaveChanges of
    mrYes: InvokeSave;
    mrNo: Cancel;
    mrCancel: Abort; // Access violation occurs in this piece
    end;
    end;
    end;



    I hope it would be sufficient to trace out the prob.
    Thanks in advance.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2006
    Location
    Carlsbad, CA
    Posts
    2,057
    Rep Power
    383
    What is the code for CheckDS?
    What is the code for VerifySaveChanges?

    Are you sure FDM is actually assigned (as oppose to simply not nil)?
    Delphi naming conventions would indicate that FDM is a private field of a class.
    If that is true, you should not be accessing it from a procedure that is not a method of the same class.

    [ALSO]
    What is the code for mrYes (InvokeSave) and mrCancel (Cancel)?
    It would seem that you are doing something in both methods that avoids the AV.

    Clive
    Last edited by clivew; March 15th, 2013 at 02:23 AM.

IMN logo majestic logo threadwatch logo seochat tools logo