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

R: Warn if error is too long to print properly #232

Merged
merged 2 commits into from
May 3, 2024

Conversation

WardBrian
Copy link
Collaborator

@WardBrian WardBrian commented May 3, 2024

R has a maximum length for warnings/error messages, controlled by options(warning.length). This has lead to some confusion before, see 1, 2

This adds a check to places where we know there could be long error messages generated by BridgeStan and adds a warning if we know they will be truncated. This warning is reported alongside the error and should help people debug

Copy link
Owner

@roualdes roualdes left a comment

Choose a reason for hiding this comment

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

Good idea. Do we have a recommended first guess on what warning.length they could try?

Maybe we could say options(warning.length = 1000) or whatever our first best guess is, if not 1000.

@WardBrian
Copy link
Collaborator Author

1000 is the default, the linked SO question suggests values above 8000 don’t do anything.

We could also just print it and have the error message say “hey, we printed it just now”, but I think that would interact poorly with anyone trying to intercept errors

@WardBrian WardBrian merged commit 0bf8aae into main May 3, 2024
19 checks passed
@WardBrian WardBrian deleted the R/warn-if-message-too-long branch May 3, 2024 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants