Skip to content

Improve consistency of error handling in special handler failure path#394

Open
sage-mode-hunter wants to merge 3 commits into
vstakhov:masterfrom
sage-mode-hunter:fix-special-handler-error-consistency-v2
Open

Improve consistency of error handling in special handler failure path#394
sage-mode-hunter wants to merge 3 commits into
vstakhov:masterfrom
sage-mode-hunter:fix-special-handler-error-consistency-v2

Conversation

@sage-mode-hunter

Copy link
Copy Markdown

This patch improves consistency in libucl error handling for special handler failures.

Problem

In the special handler execution path, when a handler fails, libucl unconditionally overwrites parser->err with:

"call for external handler failed"

However, other parts of the parser (e.g. variable expansion and core parser logic) follow a different pattern where an existing error is preserved if already set.

This leads to inconsistent error ownership behavior across modules.

Change

The patch ensures that a previously set error from the special handler is not overwritten:

if (parser->err == NULL) {
    ucl_create_err(&parser->err,
        "call for external handler failed");
}

@sage-mode-hunter

Copy link
Copy Markdown
Author

gentle ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant