OmniSciDB  04ee39c94c
ErrorHandling.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <stdexcept>
20 
21 #include "Descriptors/Types.h"
22 
26 };
27 
28 class QueryExecutionError : public std::runtime_error {
29  public:
30  QueryExecutionError(const int32_t error_code, const std::string& e)
31  : std::runtime_error("Query execution failed with error code " +
32  std::to_string(error_code) + "\n" + e)
33  , error_code_(error_code) {}
34 
36  const std::string& e,
37  const QueryExecutionProperties& execution_properties)
38  : std::runtime_error("Query execution failed with error code " +
39  std::to_string(error_code) + "\n" + e)
40  , error_code_(error_code)
41  , execution_props_(execution_properties) {}
42 
44  const QueryExecutionProperties& execution_properties)
45  : std::runtime_error("Query execution failed with error code " +
46  std::to_string(error_code))
47  , error_code_(error_code)
48  , execution_props_(execution_properties) {}
49 
51  : std::runtime_error("Query execution failed with error code " +
52  std::to_string(error_code))
53  , error_code_(error_code) {}
54 
55  int32_t getErrorCode() const { return error_code_; }
56 
57  bool wasMultifragKernelLaunch() const {
58  return execution_props_ && (*execution_props_).was_multifrag_kernel_launch;
59  }
60 
61  protected:
62  int32_t error_code_;
63  boost::optional<QueryExecutionProperties> execution_props_;
64 };
int32_t getErrorCode() const
Definition: ErrorHandling.h:55
boost::optional< QueryExecutionProperties > execution_props_
Definition: ErrorHandling.h:63
QueryExecutionError(const int32_t error_code, const std::string &e)
Definition: ErrorHandling.h:30
bool wasMultifragKernelLaunch() const
Definition: ErrorHandling.h:57
QueryExecutionError(const int32_t error_code, const QueryExecutionProperties &execution_properties)
Definition: ErrorHandling.h:43
QueryExecutionError(const int32_t error_code)
Definition: ErrorHandling.h:50
std::string to_string(char const *&&v)
QueryDescriptionType query_type
Definition: ErrorHandling.h:24
const int8_t const int64_t const uint64_t const int32_t const int64_t int64_t uint32_t const int64_t int32_t * error_code
QueryExecutionError(const int32_t error_code, const std::string &e, const QueryExecutionProperties &execution_properties)
Definition: ErrorHandling.h:35
QueryDescriptionType
Definition: Types.h:26