| @@ -418,15 +418,12 @@ | ||
| 418 | 418 | throw new \Exception(wp_kses_post($result->get_error_message())); |
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | $activate = true; |
| 422 | - | |
| 423 | - } catch (\Exception $e) { | |
| 424 | - throw new \Exception(esc_html($e->getMessage())); | |
| 422 | + } finally { | |
| 423 | + // Discard feedback. | |
| 424 | + ob_end_clean(); | |
| 425 | 425 | } |
| 426 | - | |
| 427 | - // Discard feedback. | |
| 428 | - ob_end_clean(); | |
| 429 | 426 | } |
| 430 | 427 | |
| 431 | 428 | wp_clean_plugins_cache(); |
| 432 | 429 | |
| @@ -431,16 +428,12 @@ | ||
| 431 | 428 | wp_clean_plugins_cache(); |
| 432 | 429 | |
| 433 | 430 | // Activate this thing. |
| 434 | 431 | if ($activate) { |
| 435 | - try { | |
| 436 | - $result = activate_plugin($installed ? $installed_plugins[$plugin_file] : $plugin_slug . '/' . $plugin_file); | |
| 432 | + $result = activate_plugin($installed ? $installed_plugins[$plugin_file] : $plugin_slug . '/' . $plugin_file); | |
| 437 | 433 | |
| 438 | - if (is_wp_error($result)) { | |
| 439 | - throw new \Exception(esc_html($result->get_error_message())); | |
| 440 | - } | |
| 441 | - } catch (\Exception $e) { | |
| 442 | - throw new \Exception(esc_html($e->getMessage())); | |
| 434 | + if (is_wp_error($result)) { | |
| 435 | + throw new \Exception(wp_kses_post($result->get_error_message())); | |
| 443 | 436 | } |
| 444 | 437 | } |
| 445 | 438 | } |
| 446 | 439 | } |