add exception class in common. using unique ptr in VExplodeBitmapTableFunction support single exception or nested exception, like this: ---SingleException [E-100] test OS_ERROR bug @ 0x55e80b93c0d9 doris::Exception::Exception<>() @ 0x55e80b938df1 doris::ExceptionTest_NestedError_Test::TestBody() @ 0x55e82e16bafb testing::internal::HandleSehExceptionsInMethodIfSupported<>() @ 0x55e82e15ab3a testing::internal::HandleExceptionsInMethodIfSupported<>() @ 0x55e82e1361e3 testing::Test::Run() @ 0x55e82e136f29 testing::TestInfo::Run() @ 0x55e82e1376e4 testing::TestSuite::Run() @ 0x55e82e148042 testing::internal::UnitTestImpl::RunAllTests() @ 0x55e82e16dcab testing::internal::HandleSehExceptionsInMethodIfSupported<>() @ 0x55e82e15ce4a testing::internal::HandleExceptionsInMethodIfSupported<>() @ 0x55e82e147bab testing::UnitTest::Run() @ 0x55e80c4b39e3 RUN_ALL_TESTS() @ 0x55e80c4a99b5 main @ 0x7f0a619d0493 __libc_start_main @ 0x55e80b84602a _start @ (nil) (unknown)
41 lines
1.6 KiB
C++
41 lines
1.6 KiB
C++
// Licensed to the Apache Software Foundation (ASF) under one
|
|
// or more contributor license agreements. See the NOTICE file
|
|
// distributed with this work for additional information
|
|
// regarding copyright ownership. The ASF licenses this file
|
|
// to you under the Apache License, Version 2.0 (the
|
|
// "License"); you may not use this file except in compliance
|
|
// with the License. You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing,
|
|
// software distributed under the License is distributed on an
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
// KIND, either express or implied. See the License for the
|
|
// specific language governing permissions and limitations
|
|
// under the License.
|
|
|
|
#include "common/exception.h"
|
|
|
|
#include "util/stack_util.h"
|
|
namespace doris {
|
|
|
|
Exception::Exception(int code, const std::string_view msg) {
|
|
_code = code;
|
|
_err_msg = std::make_unique<ErrMsg>();
|
|
_err_msg->_msg = msg;
|
|
_err_msg->_stack = get_stack_trace();
|
|
}
|
|
Exception::Exception(const Exception& nested, int code, const std::string_view msg) {
|
|
_code = code;
|
|
_err_msg = std::make_unique<ErrMsg>();
|
|
_err_msg->_msg = msg;
|
|
_err_msg->_stack = get_stack_trace();
|
|
_nested_excption = std::make_unique<Exception>();
|
|
_nested_excption->_code = nested._code;
|
|
_nested_excption->_err_msg = std::make_unique<ErrMsg>();
|
|
_nested_excption->_err_msg->_msg = nested._err_msg->_msg;
|
|
_nested_excption->_err_msg->_stack = nested._err_msg->_stack;
|
|
}
|
|
|
|
} // namespace doris
|