Shawn Walker wrote:
Brock Pytlik wrote:
Shawn Walker wrote:
As such, if you can't use an api_error here, you should consider creating a custom exception and then having the calling client api code re-raise the exception as one of its own so that the client can exit cleanly. Even if this case should never happen, our client should not traceback when encountering known error cases.
I disagree. If it's going to be an issue, I'll change the code to check one value and default to the other. I put the assertion in as a check against future versions. I don't think adding more exception pumbling around this bit of code is appropriate.

Put another way, I don't think it's agreeable to put code in that will knowingly cause the client to traceback if a particular error case occurs.

However you want to handle it so that the client won't traceback is fine with me.

The problem with assertions is that they're meant for developers but users inevitably trigger them.

Cheers,
Ok, let me try one more approach. Any of the code we have can traceback if you hand it bizzare enough arguments. Take read_catalog in moules/server/catalog.py. If I call that method and hand it an Exception as it's cat argument, a Class object as it's path argument, and a Indexer instance as it's pub argument, I'm not sure what'll happen, but it'll probably be bad. It'll probably be a stack trace. There are limits to how defensive we've chosen to make the general functions we write. In my opinion, this particular function doesn't merit the additional defensive code you're asking for. If this was an API function, i'd be more amenable. It's not. It's a function that's internal to our code. If our own code passes the wrong arguments to a function, stack traces are acceptable in my opinion since that should be caught during development, just like passing in arguments of totally wrong types is caught during development.

Brock
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to