001    /*
002     *  jDTAUS - DTAUS fileformat.
003     *  Copyright (c) 2005 Christian Schulte <cs@schulte.it>
004     *
005     *  This library is free software; you can redistribute it and/or
006     *  modify it under the terms of the GNU Lesser General Public
007     *  License as published by the Free Software Foundation; either
008     *  version 2.1 of the License, or any later version.
009     *
010     *  This library is distributed in the hope that it will be useful,
011     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
012     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013     *  Lesser General Public License for more details.
014     *
015     *  You should have received a copy of the GNU Lesser General Public
016     *  License along with this library; if not, write to the Free Software
017     *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
018     *
019     */
020    package org.jdtaus.core.container;
021    
022    import java.util.Locale;
023    
024    /**
025     * Unrecoverable error thrown if no working {@code Context} is available in the
026     * system.
027     *
028     * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
029     * @version $Id: ContextError.java 1914 2007-03-01 02:20:44Z schulte2005 $
030     */
031    public class ContextError extends Error
032    {
033    
034        //--Constructors------------------------------------------------------------
035    
036        /**
037         * Creates a new instance of {@code ContextError} taking a causing
038         * {@code Throwable}.
039         *
040         * @param cause the causing throwable.
041         */
042        public ContextError(final Throwable cause)
043        {
044            super(ContextErrorBundle.getContextErrorMessage(
045                Locale.getDefault()).format(new Object[] {
046                cause != null ? cause.getMessage() : null }), cause);
047    
048        }
049    
050        /**
051         * Creates a new instance of {@code ContextError} taking a message.
052         *
053         * @param msg the message describing the error.
054         */
055        public ContextError(final String msg)
056        {
057            super(ContextErrorBundle.getContextErrorMessage(
058                Locale.getDefault()).format(new Object[] { msg }));
059    
060        }
061    
062        //------------------------------------------------------------Constructors--
063    
064    }