xref: /webtrees/app/Exceptions/GedcomErrorException.php (revision 81b729d3a9a6e0a0e8b96285d1ad7955d2d0c659)
1b37c98e1SGreg Roach<?php
23976b470SGreg Roach
3b37c98e1SGreg Roach/**
4b37c98e1SGreg Roach * webtrees: online genealogy
589f7189bSGreg 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
1589f7189bSGreg 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
25*81b729d3SGreg Roachuse function e;
26*81b729d3SGreg Roach
27b37c98e1SGreg Roach/**
28b37c98e1SGreg Roach * Exception thrown when importing invalid GEDCOM data.
29b37c98e1SGreg Roach */
30b37c98e1SGreg Roachclass GedcomErrorException extends Exception
31b37c98e1SGreg Roach{
32b37c98e1SGreg Roach    /**
33c3e5dff8SGreg Roach     * GedcomErrorException constructor.
34b37c98e1SGreg Roach     *
35b37c98e1SGreg Roach     * @param string $gedcom
36b37c98e1SGreg Roach     */
37b37c98e1SGreg Roach    public function __construct(string $gedcom)
38b37c98e1SGreg Roach    {
39b37c98e1SGreg Roach        $message = I18N::translate('Invalid GEDCOM record') . '<pre>' . e($gedcom) . '</pre>';
40b37c98e1SGreg Roach
41b37c98e1SGreg Roach        parent::__construct($message);
42b37c98e1SGreg Roach    }
43b37c98e1SGreg Roach}
44