Skip to content

Exceptions in kirbytext rendering are catched but not handled #2625

@qwerdee

Description

@qwerdee

Describe the bug
Kirbytags only are rendered when there is now error thrown inside. All Errors that occure are caught but not handled. While it is good to ensure editors are not able to break the page with kirbytags, this makes it really hard to develop and debug kirbytags.

try {
return static::$tagClass::parse($match[0], $data, $options)->render();
} catch (Exception $e) {
return $match[0];
}

To Reproduce

Throw an exception:

Kirby::plugin('my/custom-tag', [
    'tags' => [
        'test' => [
            'html' => function (KirbyTag $tag) {
                throw new Exception('something happened');
            },
        ],
    ],
]);

In Content:

(test: 123)

Expected behavior

Perhaps bubble exceptions when debug is set to true.

Kirby Version
3.3.6

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions