001/***************************************************************************
002 * Copyright 2010 Global Biodiversity Information Facility Secretariat
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005 * use this file except in compliance with the License. You may obtain a copy of
006 * the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013 * License for the specific language governing permissions and limitations under
014 * the License.
015 ***************************************************************************/
016
017package org.gbif.api.exception;
018
019import org.gbif.api.vocabulary.NameType;
020
021/**
022 * Exception thrown when a scientific name cannot be parsed.
023 * The type property is set for known name types that cannot be parsed but be detected, for example hybrids, virus or placeholder names.
024 * The name property holds the name that cannot be parsed.
025 */
026public class UnparsableException extends Exception {
027
028  public final NameType type;
029  public final String name;
030
031  public UnparsableException(NameType type, String name) {
032    super("Name of type " + type.name() + " unparsable: " + name);
033    this.type = type;
034    this.name = name;
035  }
036}