roualdes / bridgestan

BridgeStan provides efficient in-memory access through Python, Julia, and R to the methods of a Stan model.
https://roualdes.github.io/bridgestan
BSD 3-Clause "New" or "Revised" License
87 stars 12 forks source link

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

Closed WardBrian closed 2 months ago

WardBrian commented 2 months ago

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

WardBrian commented 2 months ago

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