001/*
002 *  jDTAUS Core API
003 *  Copyright (C) 2005 Christian Schulte
004 *  <cs@schulte.it>
005 *
006 *  This library is free software; you can redistribute it and/or
007 *  modify it under the terms of the GNU Lesser General Public
008 *  License as published by the Free Software Foundation; either
009 *  version 2.1 of the License, or any later version.
010 *
011 *  This library is distributed in the hope that it will be useful,
012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 *  Lesser General Public License for more details.
015 *
016 *  You should have received a copy of the GNU Lesser General Public
017 *  License along with this library; if not, write to the Free Software
018 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
019 *
020 */
021package org.jdtaus.core.container;
022
023import java.util.Locale;
024
025/**
026 * Unrecoverable error thrown if no working {@code Model} is available in the
027 * system.
028 *
029 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
030 * @version $JDTAUS: ModelError.java 8641 2012-09-27 06:45:17Z schulte $
031 */
032public class ModelError extends Error
033{
034    //--Constants---------------------------------------------------------------
035
036    /** Serial version UID for backwards compatibility with 1.0.x classes. */
037    private static final long serialVersionUID = 7947238717492660462L;
038
039    //---------------------------------------------------------------Constants--
040    //--Constructors------------------------------------------------------------
041
042    /**
043     * Creates a new instance of {@code ModelError} taking a causing
044     * {@code Throwable}.
045     *
046     * @param cause the causing throwable.
047     */
048    public ModelError( final Throwable cause )
049    {
050        super( ModelErrorBundle.getInstance().
051               getModelErrorMessage( Locale.getDefault(), cause != null
052                                     ? cause.getMessage()
053                                     : null ), cause );
054
055    }
056
057    /**
058     * Creates a new instance of {@code ModelError} taking a message.
059     *
060     * @param msg the message describing the error.
061     */
062    public ModelError( final String msg )
063    {
064        super( ModelErrorBundle.getInstance().
065               getModelErrorMessage( Locale.getDefault(), msg ) );
066
067    }
068
069    //------------------------------------------------------------Constructors--
070}