1 // Copyright 2018 The Dawn Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include "dawn_native/ErrorData.h" 16 17 namespace dawn_native { 18 19 ErrorData::ErrorData() = default; 20 ErrorData(ErrorType type,std::string message)21 ErrorData::ErrorData(ErrorType type, std::string message) 22 : mType(type), mMessage(std::move(message)) { 23 } 24 AppendBacktrace(const char * file,const char * function,int line)25 void ErrorData::AppendBacktrace(const char* file, const char* function, int line) { 26 BacktraceRecord record; 27 record.file = file; 28 record.function = function; 29 record.line = line; 30 31 mBacktrace.push_back(std::move(record)); 32 } 33 GetType() const34 ErrorType ErrorData::GetType() const { 35 return mType; 36 } 37 GetMessage() const38 const std::string& ErrorData::GetMessage() const { 39 return mMessage; 40 } 41 GetBacktrace() const42 const std::vector<ErrorData::BacktraceRecord>& ErrorData::GetBacktrace() const { 43 return mBacktrace; 44 } 45 46 } // namespace dawn_native 47