Merge pull request #17866 from colemanw/customFix
[civicrm-core.git] / CRM / Core / Exception / PrematureExitException.php
CommitLineData
62e245e6 1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
62e245e6 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
62e245e6 9 +--------------------------------------------------------------------+
10 */
11
12/**
13 * Exception thrown during tests where live code would exit.
14 *
15 * This is when the code would exit in live mode.
16 *
17 * @param string $message
18 * The human friendly error message.
19 * @param string $error_code
20 * A computer friendly error code. By convention, no space (but underscore allowed).
21 * ex: mandatory_missing, duplicate, invalid_format
22 * @param array $data
23 * Extra params to return. eg an extra array of ids. It is not mandatory, but can help the computer using the api.
24 * Keep in mind the api consumer isn't to be trusted. eg. the database password is NOT a good extra data.
25 */
26class CRM_Core_Exception_PrematureExitException extends RuntimeException {
27
68989e71 28 /**
29 * Construct the exception. Note: The message is NOT binary safe.
30 *
31 * @link https://php.net/manual/en/exception.construct.php
32 *
33 * @param string $message [optional] The Exception message to throw.
34 * @param array $errorData
35 * @param int $error_code
36 * @param throwable $previous [optional] The previous throwable used for the exception chaining.
37 */
38 public function __construct($message = "", $errorData = [], $error_code = 0, throwable $previous = NULL) {
39 parent::__construct($message, $error_code, $previous);
40 $this->errorData = $errorData + ['error_code' => $error_code];
41 }
42
62e245e6 43}