← All changes
|
src/Campaigns/Repositories/CampaignPageRepository.php
+6
-3
4.16.7
→
4.18.0
View file →
| @@ -54,8 +54,9 @@ | ||
| 54 | 54 | return $this->queryByCampaignId($campaignId)->get(); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 58 | 59 | * @since 4.0.0 |
| 59 | 60 | * @throws Exception |
| 60 | 61 | */ |
| 61 | 62 | public function insert(CampaignPage $campaignPage): void |
| @@ -108,9 +109,9 @@ | ||
| 108 | 109 | DB::query('ROLLBACK'); |
| 109 | 110 | |
| 110 | 111 | Log::error('Failed creating a campaign page', [$campaignPage]); |
| 111 | 112 | |
| 112 | - throw new $exception('Failed creating a campaign page'); | |
| 113 | + throw new Exception('Failed creating a campaign page', 0, $exception); | |
| 113 | 114 | } |
| 114 | 115 | |
| 115 | 116 | DB::query('COMMIT'); |
| 116 | 117 | |
| @@ -117,8 +118,9 @@ | ||
| 117 | 118 | Hooks::doAction('givewp_campaign_page_created', $campaignPage); |
| 118 | 119 | } |
| 119 | 120 | |
| 120 | 121 | /** |
| 122 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 121 | 123 | * @since 4.0.0 |
| 122 | 124 | * @throws Exception |
| 123 | 125 | */ |
| 124 | 126 | public function update(CampaignPage $campaignPage): void |
| @@ -151,9 +153,9 @@ | ||
| 151 | 153 | DB::query('ROLLBACK'); |
| 152 | 154 | |
| 153 | 155 | Log::error('Failed updating a campaign page', [$campaignPage]); |
| 154 | 156 | |
| 155 | - throw new $exception('Failed updating a campaign page'); | |
| 157 | + throw new Exception('Failed updating a campaign page', 0, $exception); | |
| 156 | 158 | } |
| 157 | 159 | |
| 158 | 160 | DB::query('COMMIT'); |
| 159 | 161 | |
| @@ -160,8 +162,9 @@ | ||
| 160 | 162 | Hooks::doAction('givewp_campaign_page_updated', $campaignPage); |
| 161 | 163 | } |
| 162 | 164 | |
| 163 | 165 | /** |
| 166 | + * @since 4.18.0 Keep the original error as the previous exception when the write fails. | |
| 164 | 167 | * @since 4.0.0 |
| 165 | 168 | * @throws Exception |
| 166 | 169 | */ |
| 167 | 170 | public function delete(CampaignPage $campaignPage): bool |
| @@ -182,9 +185,9 @@ | ||
| 182 | 185 | DB::query('ROLLBACK'); |
| 183 | 186 | |
| 184 | 187 | Log::error('Failed deleting a campaign page', [$campaignPage]); |
| 185 | 188 | |
| 186 | - throw new $exception('Failed deleting a campaign page'); | |
| 189 | + throw new Exception('Failed deleting a campaign page', 0, $exception); | |
| 187 | 190 | } |
| 188 | 191 | |
| 189 | 192 | DB::query('COMMIT'); |
| 190 | 193 | |