Exception of type 'System.Exception' was thrown. 如何解决

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Exception of type 'System.Exception' was thrown. 如何解决相关的知识,希望对你有一定的参考价值。

参考技术A 查看异常的堆栈信息,跟踪调试。
在出现异常的地方打断点,单步进入。。。追问

谢谢!有没有更详细点的步骤?

catching polymorphic type 'class std::exception' by value [-Wcatch-value=]

class Person
public:
    Person()
        mAge = 0;
    
    void setAge(int age)
        if(age < 0 || age > 100)
            throw out_of_range("年龄应该在0-100之间!");
        
        this->mAge = age;
    
public:
    int mAge;
;

void test01()
    Person p;
    try
        p.setAge(1024);
    catch(out_of_range& e)//此处报错
        cout << e.what() << endl;
    

gcc编译报错catching polymorphic type ‘class std::exception‘ by value [-Wcatch-value=];

以上是关于Exception of type 'System.Exception' was thrown. 如何解决的主要内容,如果未能解决你的问题,请参考以下文章

Exception of type 'System.OutOfMemoryException' was thrown.是啥意思 如何解决 详细讲解下在线等 急

ReactNative libc++_shared.so 冲突导致的uncaught exception of type std::bad_cast:

Cannot convert value of type 'java.lang.String' to required type 'javax.sql.DataSource&#

debian The type initializer for 'System.Drawing.KnownColors' threw an exception

catching polymorphic type 'class std::exception' by value [-Wcatch-value=]

exception of type was thrown提示和网络有关系吗