← All changes
|
src/Campaigns/Repositories/CampaignRepository.php
+12
-6
4.16.7.1
→
4.18.0
View file →
| @@ -77,8 +77,9 @@ | ||
| 77 | 77 | ->where('forms.form_id', $formId); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 81 | 82 | * @since 4.0.0 |
| 82 | 83 | * |
| 83 | 84 | * @throws Exception|InvalidArgumentException |
| 84 | 85 | */ |
| @@ -125,9 +126,9 @@ | ||
| 125 | 126 | DB::query('ROLLBACK'); |
| 126 | 127 | |
| 127 | 128 | Log::error('Failed creating a campaign', compact('campaign')); |
| 128 | 129 | |
| 129 | - throw new $exception('Failed creating a campaign'); | |
| 130 | + throw new Exception('Failed creating a campaign', 0, $exception); | |
| 130 | 131 | } |
| 131 | 132 | |
| 132 | 133 | DB::query('COMMIT'); |
| 133 | 134 | |
| @@ -138,8 +139,9 @@ | ||
| 138 | 139 | Hooks::doAction('givewp_campaign_created', $campaign); |
| 139 | 140 | } |
| 140 | 141 | |
| 141 | 142 | /** |
| 143 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 142 | 144 | * @since 4.0.0 |
| 143 | 145 | * |
| 144 | 146 | * @throws Exception|InvalidArgumentException |
| 145 | 147 | */ |
| @@ -177,9 +179,9 @@ | ||
| 177 | 179 | DB::query('ROLLBACK'); |
| 178 | 180 | |
| 179 | 181 | Log::error('Failed updating a campaign', compact('campaign')); |
| 180 | 182 | |
| 181 | - throw new $exception('Failed updating a campaign'); | |
| 183 | + throw new Exception('Failed updating a campaign', 0, $exception); | |
| 182 | 184 | } |
| 183 | 185 | |
| 184 | 186 | DB::query('COMMIT'); |
| 185 | 187 | |
| @@ -186,8 +188,9 @@ | ||
| 186 | 188 | Hooks::doAction('givewp_campaign_updated', $campaign); |
| 187 | 189 | } |
| 188 | 190 | |
| 189 | 191 | /** |
| 192 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 190 | 193 | * @since 4.0.0 |
| 191 | 194 | * |
| 192 | 195 | * @throws Exception |
| 193 | 196 | */ |
| @@ -217,9 +220,9 @@ | ||
| 217 | 220 | DB::query('ROLLBACK'); |
| 218 | 221 | |
| 219 | 222 | Log::error('Failed creating a campaign form relationship', compact('campaign')); |
| 220 | 223 | |
| 221 | - throw new $exception('Failed creating a campaign form relationship'); | |
| 224 | + throw new Exception('Failed creating a campaign form relationship', 0, $exception); | |
| 222 | 225 | } |
| 223 | 226 | |
| 224 | 227 | DB::query('COMMIT'); |
| 225 | 228 | |
| @@ -226,8 +229,9 @@ | ||
| 226 | 229 | Hooks::doAction('givewp_campaign_form_relationship_created', $campaign, $donationFormId, $isDefault); |
| 227 | 230 | } |
| 228 | 231 | |
| 229 | 232 | /** |
| 233 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 230 | 234 | * @since 4.0.0 |
| 231 | 235 | * |
| 232 | 236 | * @throws Exception |
| 233 | 237 | */ |
| @@ -249,9 +253,9 @@ | ||
| 249 | 253 | DB::query('ROLLBACK'); |
| 250 | 254 | |
| 251 | 255 | Log::error('Failed updating the campaign default form', compact('campaign')); |
| 252 | 256 | |
| 253 | - throw new $exception('Failed updating the campaign default form'); | |
| 257 | + throw new Exception('Failed updating the campaign default form', 0, $exception); | |
| 254 | 258 | } |
| 255 | 259 | |
| 256 | 260 | DB::query('COMMIT'); |
| 257 | 261 | |
| @@ -258,8 +262,9 @@ | ||
| 258 | 262 | Hooks::doAction('givewp_campaign_default_form_updated', $campaign, $donationFormId); |
| 259 | 263 | } |
| 260 | 264 | |
| 261 | 265 | /** |
| 266 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 262 | 267 | * @since 4.0.0 |
| 263 | 268 | * |
| 264 | 269 | * @throws Exception |
| 265 | 270 | */ |
| @@ -278,9 +283,9 @@ | ||
| 278 | 283 | DB::query('ROLLBACK'); |
| 279 | 284 | |
| 280 | 285 | Log::error('Failed deleting a campaign', compact('campaign')); |
| 281 | 286 | |
| 282 | - throw new $exception('Failed deleting a campaign'); | |
| 287 | + throw new Exception('Failed deleting a campaign', 0, $exception); | |
| 283 | 288 | } |
| 284 | 289 | |
| 285 | 290 | DB::query('COMMIT'); |
| 286 | 291 | |
| @@ -289,8 +294,9 @@ | ||
| 289 | 294 | return true; |
| 290 | 295 | } |
| 291 | 296 | |
| 292 | 297 | /** |
| 298 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 293 | 299 | * @since 4.0.0 |
| 294 | 300 | * |
| 295 | 301 | * @throws Exception |
| 296 | 302 | */ |
| @@ -344,9 +350,9 @@ | ||
| 344 | 350 | 'campaignsToMergeIds' => $campaignsToMergeIds, |
| 345 | 351 | 'destinationCampaign' => compact('destinationCampaign'), |
| 346 | 352 | ]); |
| 347 | 353 | |
| 348 | - throw new $exception('Failed merging campaigns into destination campaign'); | |
| 354 | + throw new Exception('Failed merging campaigns into destination campaign', 0, $exception); | |
| 349 | 355 | } |
| 350 | 356 | |
| 351 | 357 | DB::query('COMMIT'); |
| 352 | 358 | |