Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw a better exception when the model is read-only. #23888

Merged
merged 1 commit into from
Jan 15, 2021
Merged

Conversation

AndriySvyryd
Copy link
Member

Fixes #15812

@AndriySvyryd AndriySvyryd requested a review from a team January 15, 2021 02:34
/// </summary>
protected virtual void EnsureReadonly(bool shouldBeReadonly = true)
{
if (!shouldBeReadonly && IsReadonly)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this also throw when shouldBeReadonly is true but IsReadonly is false? Or if we only use this to ensure wriability, we can just have an EnsureWritable instead (might be a good idea to have that regardless, as it's called so many times)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll do the former in the next PR

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.

Improve the exception message when altering a read-only model
2 participants