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;
    }
  • 相关阅读:
    关于webpack升级过后不能打包的问题;
    数组的一些理解
    .NET(C#):使用Win32Exception类型处理Win32错误代码
    托管代码和非托管代码
    托管DLL和非托管DLL的区别
    C#实现Dll(OCX)控件自动注册的两种方法(转)
    Com组件和Dll文件区别
    C#创建COM组件
    ajaxFileUpload插件上传文件 返回 syntaxError :unexpected token
    jquery插件--ajaxfileupload.js上传文件原理分析
  • 原文地址:https://www.cnblogs.com/Fandyx/p/2461472.html
Copyright © 2011-2022 走看看