Project

Profile

Help

How to connect?
Download (2.94 KB) Statistics
| Branch: | Revision:

he / src / main / c / Saxon.C.API / SaxonApiException.h @ 01d6fdb6

1
#ifndef SAXON_API_EXCEPTION_H
2
#define SAXON_API_EXCEPTION_H
3

    
4
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
5
// Copyright (c) 2021 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

    
16
/*! <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
17
 * <p/>
18
 */
19
class SaxonApiException: public std::exception {
20

    
21
public:
22

    
23
    /**
24
     * A default Constructor. Create a SaxonApiException
25
     */
26
     SaxonApiException();
27

    
28

    
29
         /**
30
          * A constructor. Create a SaxonApiException
31
          * @param message - The detail message string of this throwable.
32
          */
33
     SaxonApiException(const char * message);
34

    
35
    /**
36
     * A Copy constructor. Create a SaxonApiException
37
     * @param ex - The exception object to copy
38
     */
39
        SaxonApiException(const SaxonApiException &ex);
40

    
41

    
42

    
43
    /** Returns a pointer to the (constant) error description.
44
        *  @return A pointer to a const char*. The underlying memory
45
        *          is in posession of the Exception object. Callers must
46
        *          not attempt to free the memory.
47
             */
48
    virtual const char * what ();
49

    
50
    /**
51
     * A constructor. Create a SaxonApiException
52
     * @param message - The detail message string of this throwable.
53
     * @param errorCode - The error code of the underlying exception thrown, if known
54
     * @param systemId - Get the URI of the module associated with the exception, if known.
55
     * @param lineNumber - The line number in the stylesheet related to cause of the exception
56
     */
57
        SaxonApiException(const char * message, const char * errorCode, const char * systemId, int linenumber);
58

    
59

    
60
    /**
61
     * A destructor.
62
     */
63
        virtual ~SaxonApiException() throw ();
64

    
65

    
66

    
67
    /**
68
     * Get the error code associated with the exception, if it exists
69
     * @return the associated error code, or null if no error code is available
70
     */
71
        const char * getErrorCode();
72

    
73

    
74
        int getLineNumber();
75

    
76

    
77
    /**
78
     * Returns the detail message string of the throwable, if there is one
79
     * @return the detail message string of this <tt>Throwable</tt> instance
80
     *         (which may be <tt>null</tt>).
81
     */
82
        const char * getMessage();
83

    
84
        /**
85
        * Get the URI of the module associated with the exception, if known.
86
        */
87
        const char * getSystemId();
88

    
89

    
90

    
91

    
92
private:
93
        std::string message;
94
        int lineNumber;
95
        std::string errorCode;
96
        std::string systemId;
97
};
98

    
99
#endif /* SAXON_API_EXCEPTION_H */
(6-6/56)