aafaabf146054977eae4bc515460db29e6b91f03
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / spi / source / SourceException.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.yangtools.yang.parser.spi.source;
9
10 import com.google.common.base.Preconditions;
11 import javax.annotation.Nonnull;
12
13 /**
14  *
15  * Thrown to indicate error in YANG model source.
16  *
17  */
18 public class SourceException extends RuntimeException {
19
20     /**
21      *
22      */
23     private static final long serialVersionUID = 1L;
24
25     private final StatementSourceReference sourceRef;
26
27     public SourceException(@Nonnull String message,@Nonnull StatementSourceReference source) {
28         super(Preconditions.checkNotNull(message));
29         sourceRef = Preconditions.checkNotNull(source);
30     }
31
32     public SourceException(@Nonnull String message,@Nonnull StatementSourceReference source, Throwable cause) {
33         super(Preconditions.checkNotNull(message),cause);
34         sourceRef = Preconditions.checkNotNull(source);
35     }
36
37     public @Nonnull StatementSourceReference getSourceReference() {
38         return sourceRef;
39     }
40
41 }