Project

Profile

Help

Download (2.94 KB) Statistics
| Branch: | Revision:

he / src / main / c / Saxon.C.API / SaxonApiException.h @ 00082f6f

1 72bf04c6 Norman Walsh
#ifndef SAXON_API_EXCEPTION_H
2
#define SAXON_API_EXCEPTION_H
3
4
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5
// Copyright (c) 2020 Saxonica Limited.
6
// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7
// If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
// This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
9
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10
11
#include <iostream>
12
#include <exception>
13
14
15
/*! <code>SaxonApiException</code>. An exception thrown by the Saxon s9api API (Java). This is always a C++ wrapper for some other underlying exception in Java
16
 * <p/>
17
 */
18
class SaxonApiException: public std::exception {
19
20
public:
21
22
    /**
23
     * A default Constructor. Create a SaxonApiException
24
     */
25
     SaxonApiException();
26
27
28
         /**
29
          * A constructor. Create a SaxonApiException
30
          * @param message - The detail message string of this throwable.
31
          */
32 501beb26 O'Neil Delpratt
     SaxonApiException(const char * message);
33 72bf04c6 Norman Walsh
34
    /**
35
     * A Copy constructor. Create a SaxonApiException
36
     * @param ex - The exception object to copy
37
     */
38
        SaxonApiException(const SaxonApiException &ex);
39
40
41
42
    /** Returns a pointer to the (constant) error description.
43
        *  @return A pointer to a const char*. The underlying memory
44
        *          is in posession of the Exception object. Callers must
45
        *          not attempt to free the memory.
46
             */
47
    virtual const char * what ();
48
49
    /**
50
     * A constructor. Create a SaxonApiException
51
     * @param message - The detail message string of this throwable.
52
     * @param errorCode - The error code of the underlying exception thrown, if known
53
     * @param systemId - Get the URI of the module associated with the exception, if known.
54
     * @param lineNumber - The line number in the stylesheet related to cause of the exception
55
     */
56
        SaxonApiException(const char * message, const char * errorCode, const char * systemId, int linenumber);
57
58
59
    /**
60
     * A destructor.
61
     */
62
        virtual ~SaxonApiException() throw ();
63
64
65
66
    /**
67
     * Get the error code associated with the exception, if it exists
68
     * @return the associated error code, or null if no error code is available
69
     */
70
        const char * getErrorCode();
71
72
73
        int getLineNumber();
74
75
76
    /**
77
     * Returns the detail message string of the throwable, if there is one
78
     * @return the detail message string of this <tt>Throwable</tt> instance
79
     *         (which may be <tt>null</tt>).
80
     */
81
        const char * getMessage();
82
83
        /**
84
        * Get the URI of the module associated with the exception, if known.
85
        */
86
        const char * getSystemId();
87
88
89
90
91
private:
92
        std::string message;
93
        int lineNumber;
94
        std::string errorCode;
95
        std::string systemId;
96
};
97
98
#endif /* SAXON_API_EXCEPTION_H */