001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.camel.language; 018 019 import org.apache.camel.RuntimeCamelException; 020 import org.apache.camel.spi.Language; 021 022 /** 023 * An exception thrown if some illegal syntax is rejected by a specific language 024 * 025 * @version $Revision: 1078 $ 026 */ 027 public class IllegalSyntaxException extends RuntimeCamelException { 028 private final Language language; 029 private final String expression; 030 031 public IllegalSyntaxException(Language language, String expression) { 032 this(language, expression, null); 033 } 034 035 public IllegalSyntaxException(Language language, String expression, Throwable cause) { 036 super("Illegal syntax for language: " + language + ". Expression: " + expression, cause); 037 this.language = language; 038 this.expression = expression; 039 } 040 041 public String getExpression() { 042 return expression; 043 } 044 045 public Language getLanguage() { 046 return language; 047 } 048 }