Skip to content
Stephan Pauxberger edited this page Aug 3, 2025 · 2 revisions

KlumAST supports a hierarchy of Exception to signal problems in the various phases of the model lifecycle. The hierarchy is as follows:

KlumException

The KlumException is the base class for all exceptions thrown by KlumAST. It contains a reference to the phase in which the exception occurred.

KlumModelException

The KlumModelException is thrown when a problem occurs during the creation of the model. It contains a reference to position in the model setup where the exception was thrown. This is provided using a breadcrumb string that mimics methods and closures used in the DSL.

This is NOT the path of the object in the actual model tree, but the path in the DSL script that was used to create the model. This is useful to identify the location of the problem in the script. This also includes objects generated by Templates or nested scripts.

Examples:

A model created from a script (Using Foo.Create.From(File)) will result in the prefix: $/Foo.From:file(<filename>). If given filename contains a script with the following content, the various breadcrumbs will be created:

name "bla"

// $/Foo.From:file(myFile)

bars {
    // $/Foo.From:file(myFile)/bars
    bar {
        // $/Foo.From:file(myFile)/bars/bar
        name "bar1"
    }
    bar {
        // $/Foo.From:file(myFile)/bars/bar[2]
        name "bar2"
    }
}

NOTE: Besides being part of the exception, the breadcrumb-path is also stored in the KlumInstanceProxy of the generated object.

KlumSchemaException

The KlumSchemaException is thrown when a problem occurs during realization of a model, but likely to be originated in the schema, as opposed to the actual model. Misplaced annotations or wrong types are the most common causes for this exception.

KlumVisitorException

The KlumVisitorException is thrown when a problem occurs during the traversal of the model tree, usually as part of the execution of a phase. It contains a reference to the object in the model tree that caused the exception.

KlumValidationException

A KlumValidationException is thrown when a validation fails. It contains a list of all failed validations, each represented by a KlumVisitorException, sorted by their occurring object.

Clone this wiki locally