001/*
002 *    GeoAPI - Java interfaces for OGC/ISO standards
003 *    Copyright © 2004-2024 Open Geospatial Consortium, Inc.
004 *    http://www.geoapi.org
005 *
006 *    Licensed under the Apache License, Version 2.0 (the "License");
007 *    you may not use this file except in compliance with the License.
008 *    You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *    Unless required by applicable law or agreed to in writing, software
013 *    distributed under the License is distributed on an "AS IS" BASIS,
014 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 *    See the License for the specific language governing permissions and
016 *    limitations under the License.
017 */
018package org.opengis.util;
019
020
021/**
022 * Thrown when a {@linkplain Factory factory} cannot create an instance of the requested object.
023 *
024 * <p>If the failure is caused by an illegal authority code, then the actual exception should
025 * be {@link org.opengis.referencing.NoSuchAuthorityCodeException}. Otherwise, if the failure
026 * is caused by some error in the underlying database (e.g. {@code IOException} or {@code SQLException}),
027 * then the cause should be specified to the constructor.</p>
028 *
029 * @author  Martin Desruisseaux (IRD)
030 * @version 3.0
031 * @since   1.0
032 *
033 * @see org.opengis.referencing.operation.CoordinateOperationFactory
034 */
035public class FactoryException extends Exception {
036    /**
037     * Serial number for inter-operability with different versions.
038     */
039    private static final long serialVersionUID = -3414250034883898315L;
040
041    /**
042     * Construct an exception with no detail message.
043     */
044    public FactoryException() {
045    }
046
047    /**
048     * Constructs an exception with the specified detail message.
049     *
050     * @param message  the detail message, saved for later retrieval by the {@link #getMessage()} method.
051     */
052    public FactoryException(String message) {
053        super(message);
054    }
055
056    /**
057     * Constructs an exception with the specified cause.
058     *
059     * @param cause  the cause, saved for later retrieval by the {@link #getCause()} method.
060     */
061    public FactoryException(Throwable cause) {
062        super(cause);
063    }
064
065    /**
066     * Constructs an exception with the specified detail message and cause.
067     * The cause is the exception thrown in the underlying database
068     * (e.g. {@code IOException} or {@code SQLException}).
069     *
070     * @param message  the detail message, saved for later retrieval by the {@link #getMessage()} method.
071     * @param cause    the cause, saved for later retrieval by the {@link #getCause()} method.
072     */
073    public FactoryException(String message, Throwable cause) {
074        super(message, cause);
075    }
076}