1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package dev.metaschema.core.metapath.function;
7   
8   import dev.metaschema.core.metapath.IErrorCode;
9   import dev.metaschema.core.metapath.MetapathException;
10  import edu.umd.cs.findbugs.annotations.NonNull;
11  import edu.umd.cs.findbugs.annotations.Nullable;
12  
13  /**
14   * Represents an error that occurs during Metapath function evaluation.
15   */
16  // TODO: remove this intermediate exception?
17  public class FunctionMetapathError
18      extends MetapathException {
19  
20    /**
21     * the serial version UID.
22     */
23    private static final long serialVersionUID = 1L;
24  
25    /**
26     * Constructs a new Metapath exception with the provided {@code code},
27     * {@code message}, and no cause.
28     *
29     * @param errorCode
30     *          the error code that identifies the type of error
31     * @param message
32     *          the exception message
33     */
34    public FunctionMetapathError(
35        @NonNull IErrorCode errorCode,
36        @Nullable String message) {
37      super(errorCode, message, null);
38    }
39  
40    /**
41     * Constructs a new Metapath exception with the provided {@code code},
42     * {@code message}, and {@code cause}.
43     *
44     * @param errorCode
45     *          the error code that identifies the type of error
46     * @param message
47     *          the exception message
48     * @param cause
49     *          the original exception cause
50     */
51    public FunctionMetapathError(
52        @NonNull IErrorCode errorCode,
53        @Nullable String message,
54        @Nullable Throwable cause) {
55      super(errorCode, message, cause);
56    }
57  
58    /**
59     * Constructs a new Metapath exception with a {@code null} message and the
60     * provided {@code cause}.
61     *
62     * @param errorCode
63     *          the error code that identifies the type of error
64     * @param cause
65     *          the original exception cause
66     */
67    public FunctionMetapathError(
68        @NonNull IErrorCode errorCode,
69        @Nullable Throwable cause) {
70      super(errorCode, null, cause);
71    }
72  }