# Improve handling of error messages

XMLWordPrintable

## Details

• Type: Story
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
• Story Points:
1
• Sprint:
• Team:

## Description

astshim presently prints AST error messages to stderr. Improve this so that the messages and up as the text of exceptions, instead.

This work requires the new AST capability of registering an error handler which has just been released.

## Activity

Hide
Russell Owen added a comment -

I implemented most suggested changes. I also found that the error message buffer was not getting emptied so I fixed that and added a test for that to test_object.py.

Show
Russell Owen added a comment - I implemented most suggested changes. I also found that the error message buffer was not getting emptied so I fixed that and added a test for that to test_object.py .
Hide
Krzysztof Findeisen added a comment -

Looks good to me, although I can't offer an independent opinion on the implementation strategy. Some minor comments on GitHub.

Show
Krzysztof Findeisen added a comment - Looks good to me, although I can't offer an independent opinion on the implementation strategy. Some minor comments on GitHub.
Hide
Russell Owen added a comment -

A small change that takes advantage of a new capability of AST. I believe my solution is safe and standards-compliant, but I would appreciate a sanity check on that. If you think of a cleaner solution I'd be interested.

The one known failure mode is that the first AST error message could be printed to stderr using AST's default error handler, because astshim's error handler is not registered until the first call to ast::assertOK. However, I think it unlikely (because astshim calls assertOK often) and the consequences are minor.

Show
Russell Owen added a comment - A small change that takes advantage of a new capability of AST. I believe my solution is safe and standards-compliant, but I would appreciate a sanity check on that. If you think of a cleaner solution I'd be interested. The one known failure mode is that the first AST error message could be printed to stderr using AST's default error handler, because astshim's error handler is not registered until the first call to ast::assertOK. However, I think it unlikely (because astshim calls assertOK often) and the consequences are minor.

## People

• Assignee:
Russell Owen
Reporter:
Russell Owen
Reviewers:
Krzysztof Findeisen
Watchers:
Jim Bosch, Krzysztof Findeisen, Russell Owen