From: Bradley Meck <bradley.m...@gmail.com>
Date: Fri, 23 Mar 2012 11:49:40 -0700 (PDT)
Local: Fri, Mar 23 2012 2:49 pm
Subject: Re: No exceptions?
I would avoid hard abort(). libgmp last time I checked was doing abort() On Friday, March 23, 2012 12:06:37 PM UTC-5, Tim Caswell wrote:
> I think hard exceptions (like failed asserts in C) are fine for things > But the other class of errors that you don't want crashing your server are > I've done something like this for candor.io. It's not pretty, but seems > throw = (err) {
> global.prettyPrint(err)
> global.exit()
> }
> // Used to emit on errors when libuv badness happens
> check = (status) {
> if (status) {
> throw(require('uv').lastError())
> }
> }
> ServerPrototype = {}
> ServerPrototype.listen = (self, port, host, callback) {
> if (!host) host = "0.0.0.0"
> check(self.socket:bind(host, port))
> check(self.socket:listen(128, (status) {
> check(status)
> client = new ClientPrototype
> socket = Tcp.create()
> client.socket = socket
> check(self.socket:accept(socket))
> self.onConnection(client)
> check(socket:readStart((nread, chunk) {
> if (nread == -1) {
> err = require('uv').lastError()
> if (err.name == "EOF") {
> client.onEnd()
> } else {
> throw(err)
> }
> return
> }
> if (nread > 0) {
> client.onData(chunk)
> return
> }
> }))
> }))
> }
> On Fri, Mar 23, 2012 at 11:57 AM, Fedor Indutny <fe...@indutny.com> wrote:
>> Bradley,
>> Exceptions are good, but I'm considering Candor to be more like C, than >> As I know C works fine w/o exceptions, I'm open to introducing some sort >> Cheers,
>> On Fri, Mar 23, 2012 at 9:29 PM, Bradley Meck <bradley.m...@gmail.com>wrote:
>>> In situations where you are extending a function/method in a way that >>> ```candor
>>> Square = new Rect
>>> This example is naive, but it will come up in cases where an interface You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||