Enhance reporting of error 11913 , record has been modified
 
Forums / SmartComponent Library - Developer Forum / Enhance reporting of error 11913 , record has been modified

Enhance reporting of error 11913 , record has been modified

6 posts, 0 answered
  1. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    09 Jan 2019
    Link to this post
    We would like to provide extra information when a record has been modified by another user
    e.g. which user, when, ...

    I found that if I override LogCurrentRowModifiedIssue of the DataAccess I can throw my own Exception
       
    method protected override void LogCurrentRowModifiedIssue(phBeforeBuffer as handle):

            super:LogCurrentRowModifiedIssue(phBeforeBuffer).
            undo, throw new CceRecordModifiedByAnotherUserException().

        end method.

    1. Is this a good idea to implement it that way ?

    2. I'd like to keep the original error as inner exception but the error object is not passed as an argument. It is send to LogUnableToFindDbBufferIssue.
    Can you add this to LogCurrentRowModifiedIssue ?


     
  2. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    09 Jan 2019 in reply to Carl Verbiest
    Link to this post
    Hi Carl,

    on 1) - probably yes (without trying this out)
    on 2) - that would require an enhancement request

  3. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    09 Jan 2019 in reply to Mike Fechner
    Link to this post
    2) Ok, see SCL-2514
     
  4. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    10 Jan 2019 in reply to Carl Verbiest
    Link to this post
    Hi Carl,

    We're adding this parameter now. However ... the 11913 issue is an error which we are not throwing. We're adding this to the ERROR-STRING of the record. I assume you're intention is to THROW an error from here. 

    That should be o.k. - however it's changing our default behavior.

    Cheers,
    Mike
  5. Carl Verbiest
    Carl Verbiest avatar
    67 posts
    Registered:
    12 Oct 2018
    10 Jan 2019 in reply to Mike Fechner
    Link to this post
    Trying to move the logic to OnHandleCommitSysError .

    Does this seem correct ?

        method protected override void OnHandleCommitSysError(e as HandleCommitErrorEventArgs):

            define variable lUserInfo as character no-undo initial "unknown".
            super:OnHandleCommitSysError(e).
            if e:Handled then return.

            case e:Error:GetMessageNum (1):
                when 11913
                then do:
                    // todo, determine user info
                   e:BufferHandle:ERROR = true.
                   e:BufferHandle:DataSet:error = true.
                   e:Handled = true.
                   DatasetHelper:AddErrorString (e:BufferHandle, "&1 changed this record", lUserInfo).
                end.
            end case.

        end method.

     
  6. Mike Fechner
    Mike Fechner avatar
    342 posts
    Registered:
    14 Sep 2016
    10 Jan 2019 in reply to Carl Verbiest
    Link to this post
    Conceptionally yes. But lUserInfo is not assigned. 
6 posts, 0 answered