On 6/15/18 1:27 PM, bauss wrote:
On Friday, 15 June 2018 at 17:25:18 UTC, wjoe wrote:
On Thursday, 14 June 2018 at 22:27:42 UTC, bauss wrote:
On Thursday, 14 June 2018 at 19:06:07 UTC, Jonathan M Davis wrote:
So in case of a thrown Error, you can catch it and log it to a database.


No, you can't. Once the Error was thrown the program is in invalid state and you can't assume the logging to database will succeed.

Sure you can assume it will succeed, BUT in 9/10 cases it will and in those cases it's worth it.

I do that and it has proven to work every single time for me.

You can't assume it will succeed writing to a log file either.

In either cases you just have to try and hope for the best.

You can't assume anything when catching an Error. I would not recommend writing to a database in that case.

I brought up a similar situation last year: https://forum.dlang.org/post/ogmf1l$2mp8$1...@digitalmars.com

My solution was simply to replace the array with a wrapper which throws an exception instead. I can't figure out any better way to do it, and really, we can't change the way out-of-bounds errors work.

-Steve

Reply via email to