• 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;
    }
  • 相关阅读:
    beego学习笔记(4):开发文档阅读(1)
    go的匿名组合
    beego学习笔记(3)
    beego学习笔记(2)
    python发送post请求发送json数据时,报415的原因和处理方法。
    Kali Linux的安装
    linux下配置mysql的远程访问
    selenium学习笔记
    Fiddler使用方法简介
    使用webdriver打开本地浏览器--python版
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2461472.html
Copyright © 2020-2023  润新知