1/* 2 * Copyright 2013-2014, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7#include "Exception.h" 8 9 10using namespace BPackageKit; 11 12 13Exception::Exception(BTransactionError error) 14 : 15 fError(error), 16 fSystemError(B_ERROR), 17 fPackageName(), 18 fPath1(), 19 fPath2(), 20 fString1(), 21 fString2() 22{ 23} 24 25Exception& 26Exception::SetSystemError(status_t error) 27{ 28 fSystemError = error; 29 return *this; 30} 31 32 33Exception& 34Exception::SetPackageName(const BString& packageName) 35{ 36 fPackageName = packageName; 37 return *this; 38} 39 40 41Exception& 42Exception::SetPath1(const BString& path) 43{ 44 fPath1 = path; 45 return *this; 46} 47 48 49Exception& 50Exception::SetPath2(const BString& path) 51{ 52 fPath2 = path; 53 return *this; 54} 55 56 57Exception& 58Exception::SetString1(const BString& string) 59{ 60 fString1 = string; 61 return *this; 62} 63 64 65Exception& 66Exception::SetString2(const BString& string) 67{ 68 fString2 = string; 69 return *this; 70} 71 72 73void 74Exception::SetOnResult(BCommitTransactionResult& result) 75{ 76 result.SetError(fError); 77 result.SetSystemError(fSystemError); 78 result.SetErrorPackage(fPackageName); 79 result.SetPath1(fPath1); 80 result.SetPath2(fPath2); 81 result.SetString1(fString1); 82 result.SetString2(fString2); 83} 84