PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / trunk
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! vtrunk
3.8.0 3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 All 112 releases
templately / modules / full-site-import / Concerns / ThrowsErrors.php

ThrowsErrors.php in Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! trunk, at modules/full-site-import/Concerns/ThrowsErrors.php

55 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Templately\Modules\FullSiteImport\Concerns;
4
5 use Exception;
6 use Templately\Modules\FullSiteImport\Exception\FatalErrorException;
7 use Templately\Modules\FullSiteImport\Exception\RetryableErrorException;
8 use Templately\Modules\FullSiteImport\Exception\UnknownErrorException;
9 use Templately\Utils\Helper;
10
11 /**
12 * Error-throw helpers for the Full Site Import pipeline.
13 *
14 * Extracted verbatim from FullSiteImport for readability. These are composed back
15 * into FullSiteImport via `use`, so $this and method resolution are identical.
16 */
17 trait ThrowsErrors {
18 /**
19 * @throws Exception
20 */
21 private function throw($message, $code = 0) {
22 if ($this->dev_mode) {
23 Helper::log($message, 'fsi_error');
24 }
25 throw new Exception($message);
26 }
27 /**
28 * @throws Exception
29 */
30 private function throw_non_retryable($message, $code = 0) {
31 if ($this->dev_mode) {
32 Helper::log($message, 'fsi_error');
33 }
34 throw new FatalErrorException($message);
35 }
36 /**
37 * @throws Exception
38 */
39 private function throw_retryable($message, $code = 0) {
40 if ($this->dev_mode) {
41 Helper::log($message, 'fsi_error');
42 }
43 throw new RetryableErrorException($message);
44 }
45 /**
46 * @throws Exception
47 */
48 private function throw_unknown($message, $code = 0) {
49 if ($this->dev_mode) {
50 Helper::log($message, 'fsi_error');
51 }
52 throw new UnknownErrorException($message);
53 }
54 }
55