| @@ -1,10 +1,27 @@ | ||
| 1 | -<?php | |
| 2 | - | |
| 3 | - | |
| 4 | -namespace Jet_Form_Builder\Exceptions; | |
| 5 | - | |
| 6 | - | |
| 7 | -class Request_Exception extends Handler_Exception { | |
| 8 | - | |
| 9 | - | |
| 10 | -} | |
| 1 | +<?php | |
| 2 | + | |
| 3 | + | |
| 4 | +namespace Jet_Form_Builder\Exceptions; | |
| 5 | + | |
| 6 | +// If this file is called directly, abort. | |
| 7 | +if ( ! defined( 'WPINC' ) ) { | |
| 8 | + die; | |
| 9 | +} | |
| 10 | + | |
| 11 | +class Request_Exception extends Handler_Exception { | |
| 12 | + | |
| 13 | + private $errors; | |
| 14 | + | |
| 15 | + public function __construct( $message = '', ...$errors ) { | |
| 16 | + $this->errors = isset( $errors[0] ) ? $errors[0] : false; | |
| 17 | + | |
| 18 | + parent::__construct( $message, ...$errors ); | |
| 19 | + } | |
| 20 | + | |
| 21 | + public function get_fields_errors() { | |
| 22 | + return $this->errors; | |
| 23 | + } | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | +} | |