1 /**
2 * Copyright (C) 2014-2017 Philip Helger (www.helger.com)
3 * philip[at]helger[dot]com
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package com.helger.schematron.pure.exchange;
18
19 import javax.annotation.Nonnull;
20 import javax.annotation.Nullable;
21
22 import com.helger.commons.io.resource.IReadableResource;
23 import com.helger.schematron.SchematronException;
24
25 /**
26 * Exception when reading Schematron fails.
27 *
28 * @author Philip Helger
29 */
30 public class SchematronReadException extends SchematronException
31 {
32 private final IReadableResource m_aRes;
33
34 /**
35 * Constructor
36 *
37 * @param aRes
38 * The resource in which the error occurred. May not be
39 * <code>null</code>.
40 * @param sMsg
41 * error message
42 */
43 public SchematronReadException (@Nonnull final IReadableResource aRes, @Nonnull final String sMsg)
44 {
45 this (aRes, sMsg, (Throwable) null);
46 }
47
48 /**
49 * Constructor
50 *
51 * @param aRes
52 * The resource in which the error occurred. May not be
53 * <code>null</code>.
54 * @param sMsg
55 * error message
56 * @param t
57 * Nested exception
58 */
59 public SchematronReadException (@Nonnull final IReadableResource aRes,
60 @Nonnull final String sMsg,
61 @Nullable final Throwable t)
62 {
63 super (aRes.getPath () + ": " + sMsg, t);
64 m_aRes = aRes;
65 }
66
67 /**
68 * @return The resource, in which the error occurred. Never <code>null</code>.
69 */
70 @Nonnull
71 public IReadableResource getResource ()
72 {
73 return m_aRes;
74 }
75 }