zoukankan      html  css  js  c++  java
  • AX 2012 解析CLR Object 抛出的错误

    案例:

    AifUtil::getClrErrorMessage()

    public static str getClrErrorMessage()
    {
        #File
        str exceptionMessage;
        System.Exception exObject, innerException;
        ;
    
        new InteropPermission(InteropKind::ClrInterop).assert();
    
        // BP deviation documented
        exObject = CLRInterop::getLastException();
        if(exObject)
        {
            // We will ignore the first message since it is always a fixed message of
            // "Exception has been thrown from target of invocation", this is from the reflection API being used
            // "ClrObject could not be created." - This is also of no use in most cases
            innerException = exObject.get_InnerException();
            while(innerException)
            {
                // BP deviation documented
                exceptionMessage = exceptionMessage + #delimiterSpace + CLRInterop::getAnyTypeForObject(innerException.get_Message());
                innerException = innerException.get_InnerException();
            }
        }
    
        CodeAccessPermission::revertAssert();
    
        return exceptionMessage;
    
    }
    

      

  • 相关阅读:
    线程与进程
    Java集合框架体系JCF
    Java异常
    抽象,接口和Object类
    Java三大特性
    面向对象
    数组
    Java 控制结构与方法
    数据类型与变量
    Java基础之入门
  • 原文地址:https://www.cnblogs.com/sxypeace/p/14103053.html
Copyright © 2011-2022 走看看