zoukankan      html  css  js  c++  java
  • Hot to catching ClrErrors in Dynamics AX

    CLRError
    // BP Deviation documented
    static utcDatetime THK_UTCDatetime(name    _datetimeStr)
    {
        utcDatetime         dt;
        InteropPermission   permission;
        name                datetimeStr = strlrTrim(_datetimeStr);
        System.Exception    ex;
        str                 ClrErrCatch;
    ;
        try
        {
            //Necessary if executed on the AOS
            permission = new InteropPermission(InteropKind::ClrInterop);
            permission.assert();
            if(permission && datetimeStr)
                // BP Deviation documented
                dt = CLRInterop::getAnyTypeForObject(System.DateTime::Parse(datetimeStr));
            else
                dt = dateTimeUtil::minValue();
        }

        catch (Exception::ClrError)
        {
            ex = ClrInterop::getLastException();
            if (ex != null)
            {
                ClrErrCatch  = ex.get_Message();
                ClrErrCatch += ex.get_StackTrace();
                ex = ex.get_InnerException();
                if (ex != null)
                {
                    ClrErrCatch += ex.ToString();
                }
            }
            throw error(ClrErrCatch);
        }
        catch(exception::Error)
        {
            throw Error(strfmt("error %1 [%2]",funcName(),_datetimeStr));
        }
        ////Revert CAS back to normal
        CodeAccessPermission::revertAssert();
        return dt;
    }
  • 相关阅读:
    PAT 解题报告 1009. Product of Polynomials (25)
    PAT 解题报告 1007. Maximum Subsequence Sum (25)
    PAT 解题报告 1003. Emergency (25)
    PAT 解题报告 1004. Counting Leaves (30)
    【转】DataSource高级应用
    tomcat下jndi配置
    java中DriverManager跟DataSource获取getConnection有什么不同?
    理解JDBC和JNDI
    JDBC
    Dive into python 实例学python (2) —— 自省,apihelper
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2461472.html
Copyright © 2011-2022 走看看