xref: /webtrees/app/Exceptions/GedcomErrorException.php (revision 89f7189b61a494347591c99bdb92afb7d8b66e1b)
1b37c98e1SGreg Roach<?php
23976b470SGreg Roach
3b37c98e1SGreg Roach/**
4b37c98e1SGreg Roach * webtrees: online genealogy
5*89f7189bSGreg Roach * Copyright (C) 2021 webtrees development team
6b37c98e1SGreg Roach * This program is free software: you can redistribute it and/or modify
7b37c98e1SGreg Roach * it under the terms of the GNU General Public License as published by
8b37c98e1SGreg Roach * the Free Software Foundation, either version 3 of the License, or
9b37c98e1SGreg Roach * (at your option) any later version.
10b37c98e1SGreg Roach * This program is distributed in the hope that it will be useful,
11b37c98e1SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
12b37c98e1SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13b37c98e1SGreg Roach * GNU General Public License for more details.
14b37c98e1SGreg Roach * You should have received a copy of the GNU General Public License
15*89f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>.
16b37c98e1SGreg Roach */
17fcfa147eSGreg Roach
18b37c98e1SGreg Roachdeclare(strict_types=1);
19b37c98e1SGreg Roach
20b37c98e1SGreg Roachnamespace Fisharebest\Webtrees\Exceptions;
21b37c98e1SGreg Roach
22b37c98e1SGreg Roachuse Exception;
23b37c98e1SGreg Roachuse Fisharebest\Webtrees\I18N;
24b37c98e1SGreg Roach
25b37c98e1SGreg Roach/**
26b37c98e1SGreg Roach * Exception thrown when importing invalid GEDCOM data.
27b37c98e1SGreg Roach */
28b37c98e1SGreg Roachclass GedcomErrorException extends Exception
29b37c98e1SGreg Roach{
30b37c98e1SGreg Roach    /**
31c3e5dff8SGreg Roach     * GedcomErrorException constructor.
32b37c98e1SGreg Roach     *
33b37c98e1SGreg Roach     * @param string $gedcom
34b37c98e1SGreg Roach     */
35b37c98e1SGreg Roach    public function __construct(string $gedcom)
36b37c98e1SGreg Roach    {
37b37c98e1SGreg Roach        $message = I18N::translate('Invalid GEDCOM record') . '<pre>' . e($gedcom) . '</pre>';
38b37c98e1SGreg Roach
39b37c98e1SGreg Roach        parent::__construct($message);
40b37c98e1SGreg Roach    }
41b37c98e1SGreg Roach}
42