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 10 using namespace BPackageKit; 11 12 13 Exception::Exception(BTransactionError error) 14 : 15 fError(error), 16 fSystemError(B_ERROR), 17 fPackageName(), 18 fPath1(), 19 fPath2(), 20 fString1(), 21 fString2() 22 { 23 } 24 25 Exception& 26 Exception::SetSystemError(status_t error) 27 { 28 fSystemError = error; 29 return *this; 30 } 31 32 33 Exception& 34 Exception::SetPackageName(const BString& packageName) 35 { 36 fPackageName = packageName; 37 return *this; 38 } 39 40 41 Exception& 42 Exception::SetPath1(const BString& path) 43 { 44 fPath1 = path; 45 return *this; 46 } 47 48 49 Exception& 50 Exception::SetPath2(const BString& path) 51 { 52 fPath2 = path; 53 return *this; 54 } 55 56 57 Exception& 58 Exception::SetString1(const BString& string) 59 { 60 fString1 = string; 61 return *this; 62 } 63 64 65 Exception& 66 Exception::SetString2(const BString& string) 67 { 68 fString2 = string; 69 return *this; 70 } 71 72 73 void 74 Exception::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