From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (unknown [IPv6:2602:47:d673:8e00:12bf:48ff:fe7c:5584]) by hurricane.the-brannons.com (Postfix) with ESMTPSA id 3F6AD7850A for ; Sun, 23 Feb 2014 15:54:11 -0800 (PST) From: Chris Brannon To: Edbrowse-dev@lists.the-brannons.com References: <20140123175711.eklhad@comcast.net> <20140223231606.GE15819@toaster.adamthompson.me.uk> Date: Sun, 23 Feb 2014 15:53:13 -0800 In-Reply-To: <20140223231606.GE15819@toaster.adamthompson.me.uk> (Adam Thompson's message of "Sun, 23 Feb 2014 23:16:06 +0000") Message-ID: <8738j95qty.fsf@mushroom.PK5001Z> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Edbrowse-dev] memory error X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.17 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Feb 2014 23:54:11 -0000 Adam Thompson writes: > That's really annoying. I've got nothing against taking actions based on the > error number as (if I understand the mechanism correctly) > this is dependant on the type of error. > However, doing things based on the error message (which I think comes from > exceptions, user thrown or otherwise) seems a bit more fragile to me. It does come from an exception. When out-of-memory is encountered during script execution, this is converted to a JS exception. If it isn't caught, my_ErrorReporter sees it as "uncaught exception: out of memory". You're right. Acting on the error message is fragile, and I don't like it either. On the other hand, I like propagating errors to unrelated parts of the program even less. Yes, there's a good chance that we'll catch the error as soon as we call another JSAPI function, but I think there's also a chance (however slight) that we won't. E.G., suppose the script throws the out of memory exception and a bunch of memory gets reclaimed afterword. This will probably lead to completely unrelated bugs in the rest of the JavaScript executed in this context. So it's a trade-off, and I vote for trying to catch the error as soon as possible. -- Chris