Skip to content

Conversation

rosieks
Copy link

@rosieks rosieks commented Oct 25, 2024

This PR introduce Reason property in YamlException to bring back default functionality of ToString method.
Fixes #999

Comment on lines +41 to +45
/// <summary>
/// Gets the reason that originated the exception.
/// </summary>
public string Reason { get; }

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

@rosieks rosieks Aug 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How InnerException suppose to be related to reason? Reason is just plain text description what caused the error.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry, I must have been drunk when looking at this. On second look this all makes sense. Apologies again!

Copy link

@liskin liskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry again about the confusion earlier! After a good night's sleep, this all makes sense and looks like it's a very good solution. I'd consider adding a test checking that ToString contains the inner exception as well, but otherwise this is perfect.

@rosieks
Copy link
Author

rosieks commented Aug 27, 2025

Testing ToString doesn't make sense. It's inherited behavior and it's tested already somewhere else.

@liskin
Copy link

liskin commented Aug 27, 2025

Testing ToString doesn't make sense. It's inherited behavior and it's tested already somewhere else.

Suppose that's right. I saw it as a way to express "desired behavior". Sure, it's obvious that the code does what it should, it's a typed language, but having a test case saying "YamlException stringification doesn't hide the inner exception" seemed as a useful regression test. Doesn't matter that much though.

@benPearce1
Copy link

Any chance of getting this merged?

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.

YamlException.ToString hiddes stack track
4 participants