← All changes
|
src/Donations/Repositories/DonationRepository.php
+10
-5
4.16.5
→
4.18.0
View file →
| @@ -193,8 +193,9 @@ | ||
| 193 | 193 | }); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
| 197 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 197 | 198 | * @since 4.8.1 Moved campaignId assignment logic to getCoreDonationMetaForDatabase method to eliminate code duplication. |
| 198 | 199 | * @since 3.20.0 store meta using native WP functions |
| 199 | 200 | * @since 2.23.0 retrieve the post_parent instead of relying on parentId property |
| 200 | 201 | * @since 2.21.0 replace actions with givewp_donation_creating and givewp_donation_created |
| @@ -240,9 +241,9 @@ | ||
| 240 | 241 | DB::query('ROLLBACK'); |
| 241 | 242 | |
| 242 | 243 | Log::error('Failed creating a donation', compact('donation')); |
| 243 | 244 | |
| 244 | - throw new $exception('Failed creating a donation'); | |
| 245 | + throw new Exception('Failed creating a donation', 0, $exception); | |
| 245 | 246 | } |
| 246 | 247 | |
| 247 | 248 | DB::query('COMMIT'); |
| 248 | 249 | |
| @@ -262,8 +263,9 @@ | ||
| 262 | 263 | Hooks::doAction('givewp_donation_created', $donation); |
| 263 | 264 | } |
| 264 | 265 | |
| 265 | 266 | /** |
| 267 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 266 | 268 | * @since 4.6.0 Turn createdAt property updatable |
| 267 | 269 | * @since 2.23.1 Use give_update_meta() method to update entries on give_donationmeta table |
| 268 | 270 | * @since 2.23.0 retrieve the post_parent instead of relying on parentId property |
| 269 | 271 | * @since 2.21.0 replace actions with givewp_donation_updating and givewp_donation_updated |
| @@ -306,9 +308,9 @@ | ||
| 306 | 308 | DB::query('ROLLBACK'); |
| 307 | 309 | |
| 308 | 310 | Log::error('Failed updating a donation', compact('donation')); |
| 309 | 311 | |
| 310 | - throw new $exception('Failed updating a donation'); | |
| 312 | + throw new Exception('Failed updating a donation', 0, $exception); | |
| 311 | 313 | } |
| 312 | 314 | |
| 313 | 315 | $donation->updatedAt = $now; |
| 314 | 316 | |
| @@ -317,8 +319,9 @@ | ||
| 317 | 319 | Hooks::doAction('givewp_donation_updated', $donation); |
| 318 | 320 | } |
| 319 | 321 | |
| 320 | 322 | /** |
| 323 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 321 | 324 | * @since 2.21.0 replace actions with givewp_donation_deleting and givewp_donation_deleted |
| 322 | 325 | * @since 2.20.0 consolidate meta deletion into a single query |
| 323 | 326 | * @since 2.19.6 |
| 324 | 327 | * |
| @@ -342,9 +345,9 @@ | ||
| 342 | 345 | DB::query('ROLLBACK'); |
| 343 | 346 | |
| 344 | 347 | Log::error('Failed deleting a donation', compact('donation')); |
| 345 | 348 | |
| 346 | - throw new $exception('Failed deleting a donation'); | |
| 349 | + throw new Exception('Failed deleting a donation', 0, $exception); | |
| 347 | 350 | } |
| 348 | 351 | |
| 349 | 352 | DB::query('COMMIT'); |
| 350 | 353 | |
| @@ -353,8 +356,9 @@ | ||
| 353 | 356 | return true; |
| 354 | 357 | } |
| 355 | 358 | |
| 356 | 359 | /** |
| 360 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 357 | 361 | * @since 4.6.0 |
| 358 | 362 | * |
| 359 | 363 | * @throws Exception |
| 360 | 364 | */ |
| @@ -379,9 +383,9 @@ | ||
| 379 | 383 | DB::query('ROLLBACK'); |
| 380 | 384 | |
| 381 | 385 | Log::error('Failed trashing a donation', compact('donation')); |
| 382 | 386 | |
| 383 | - throw new $exception('Failed trashing a donation'); | |
| 387 | + throw new Exception('Failed trashing a donation', 0, $exception); | |
| 384 | 388 | } |
| 385 | 389 | |
| 386 | 390 | DB::query('COMMIT'); |
| 387 | 391 | |
| @@ -390,8 +394,9 @@ | ||
| 390 | 394 | return true; |
| 391 | 395 | } |
| 392 | 396 | |
| 393 | 397 | /** |
| 398 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 394 | 399 | * @since 4.12.0 |
| 395 | 400 | * |
| 396 | 401 | * @throws Exception |
| 397 | 402 | */ |
| @@ -416,9 +421,9 @@ | ||
| 416 | 421 | DB::query('ROLLBACK'); |
| 417 | 422 | |
| 418 | 423 | Log::error('Failed untrashing a donation', compact('donation')); |
| 419 | 424 | |
| 420 | - throw new $exception('Failed untrashing a donation'); | |
| 425 | + throw new Exception('Failed untrashing a donation', 0, $exception); | |
| 421 | 426 | } |
| 422 | 427 | |
| 423 | 428 | DB::query('COMMIT'); |
| 424 | 429 | |