Topic
  • 4 replies
  • Latest Post - ‏2013-07-08T18:55:07Z by llandale
EHcnck
EHcnck
78 Posts

Pinned topic suppress errors on edit()

‏2013-07-01T17:18:30Z |

Hello,

 

When opening a module(visible) in edit mode how do you suppress the DOORS report stating "Unable to open module abc...." Thank you.

- Jim

Updated on 2013-07-01T17:18:52Z at 2013-07-01T17:18:52Z by EHcnck
  • GregM_dxler
    GregM_dxler
    166 Posts

    Re: suppress errors on edit()

    ‏2013-07-01T19:58:39Z  

    Will this work?

    Module trg_mod = edit(Mod_Name, true)

    if (null trg_mod) {

       halt //no error message

    }

    Greg

  • llandale
    llandale
    2972 Posts

    Re: suppress errors on edit()

    ‏2013-07-02T17:54:46Z  

    If you mean suppress and edit error and prompt when someone else already has it open edit or share, then use the "silent" option:

    • mod = edit(Name, true, true)   // 2nd "true" means "silent"

    I don't specifically recall any "unable to open ..." errors; but if I did I would do this to trap them:

    • noError()
    • mod = edit(Name, true, true)
    • string ErrMess = lastError()
    • if (!null ErrMess) then print "error opening '" Name "':  " ErrMess

    This will trap run-time errors in Attr-DXL in the default loaded view; but I don't think traps Attr-DXL interpret errors (such as unreasolved #include reference)

    -Louie

  • EHcnck
    EHcnck
    78 Posts

    Re: suppress errors on edit()

    ‏2013-07-03T14:24:42Z  
    • llandale
    • ‏2013-07-02T17:54:46Z

    If you mean suppress and edit error and prompt when someone else already has it open edit or share, then use the "silent" option:

    • mod = edit(Name, true, true)   // 2nd "true" means "silent"

    I don't specifically recall any "unable to open ..." errors; but if I did I would do this to trap them:

    • noError()
    • mod = edit(Name, true, true)
    • string ErrMess = lastError()
    • if (!null ErrMess) then print "error opening '" Name "':  " ErrMess

    This will trap run-time errors in Attr-DXL in the default loaded view; but I don't think traps Attr-DXL interpret errors (such as unreasolved #include reference)

    -Louie

    Hello,

    The only way I found was to do the following:

        ...
        ...
        ...
        // Open Module.
        noError()
            Module m = edit(fullName(itm), false)
        string openStatus = lastError()
        
        // Print on error.
        if(!null openStatus) {
            logBuf << ((openStatus) "\n")
            return false
        }
        
        // Print on error.
        if (null m) {
            logBuf << (fullName(itm) ": [{Null} parameter]\n")
            return false
        }
        
        // Make sure "m" is visible for creating views.
        if(!isVisible(m)) {
            noError()
                edit(fullName(itm), true, false, true)
            string openStatus = lastError()
            
            // Print on error.
            if(!null openStatus) {
                logBuf << ((openStatus) "\n")
                return false
            }
            // Print on error.
            else if(!isVisible(m)) {
                logBuf << ((fullName(itm) " [Not Visible]") "\n")
                return false
            }
        }
        ...
        ...
        ...

  • llandale
    llandale
    2972 Posts

    Re: suppress errors on edit()

    ‏2013-07-08T18:55:07Z  
    • EHcnck
    • ‏2013-07-03T14:24:42Z

    Hello,

    The only way I found was to do the following:

        ...
        ...
        ...
        // Open Module.
        noError()
            Module m = edit(fullName(itm), false)
        string openStatus = lastError()
        
        // Print on error.
        if(!null openStatus) {
            logBuf << ((openStatus) "\n")
            return false
        }
        
        // Print on error.
        if (null m) {
            logBuf << (fullName(itm) ": [{Null} parameter]\n")
            return false
        }
        
        // Make sure "m" is visible for creating views.
        if(!isVisible(m)) {
            noError()
                edit(fullName(itm), true, false, true)
            string openStatus = lastError()
            
            // Print on error.
            if(!null openStatus) {
                logBuf << ((openStatus) "\n")
                return false
            }
            // Print on error.
            else if(!isVisible(m)) {
                logBuf << ((fullName(itm) " [Not Visible]") "\n")
                return false
            }
        }
        ...
        ...
        ...

    You can indeed change views when the module is open only "read".