001 /* 002 // $Id: MdxParseException.java 229 2009-05-08 19:11:29Z jhyde $ 003 // This software is subject to the terms of the Eclipse Public License v1.0 004 // Agreement, available at the following URL: 005 // http://www.eclipse.org/legal/epl-v10.html. 006 // Copyright (C) 2007-2008 Julian Hyde 007 // All Rights Reserved. 008 // You must accept the terms of that agreement to use this software. 009 */ 010 package org.olap4j.mdx.parser; 011 012 import org.olap4j.mdx.ParseRegion; 013 014 /** 015 * Exception thrown by an {@link org.olap4j.mdx.parser.MdxParser} to 016 * indicate an error in parsing. Has a {@link org.olap4j.mdx.ParseRegion}. 017 * 018 * @author jhyde 019 * @version $Id: MdxParseException.java 229 2009-05-08 19:11:29Z jhyde $ 020 */ 021 public class MdxParseException extends RuntimeException { 022 private final ParseRegion region; 023 024 /** 025 * Creates an MdxParseException with a region of the source code and a 026 * specified cause. 027 * 028 * @param region Region of source code which contains the error 029 * 030 * @param cause the cause (which is saved for later retrieval by the 031 * {@link #getCause()} method). (A <tt>null</tt> value is 032 * permitted, and indicates that the cause is nonexistent or 033 * unknown.) 034 */ 035 public MdxParseException(ParseRegion region, Throwable cause) { 036 super(cause); 037 this.region = region; 038 } 039 040 /** 041 * Creates an MdxParseException with a region of the source code and a 042 * specified detail message. 043 * 044 * @param region Region of source code which contains the error 045 * 046 * @param message the detail message. The detail message is saved for 047 * later retrieval by the {@link #getMessage()} method. 048 */ 049 public MdxParseException(ParseRegion region, String message) { 050 super(message); 051 this.region = region; 052 } 053 054 public ParseRegion getRegion() { 055 return region; 056 } 057 } 058 059 // End MdxParseException.java