Stelian, i think it's not against the rules to signal other exceptions than stream-error from sequence calls, but it's causing me more and more headaches.
the situation: i want to log errors happening while our web server is serving requests, but i want to keep the error log noise-free. network related errors are considered noise, so i have a function that decides whether the error is coming from the network stream connected to the client:
(def function is-error-from-client-stream? (error client-stream) (bind ((client-stream-fd (iolib:fd-of client-stream))) (or (and (typep error 'stream-error) (eq (stream-error-stream error) client-stream)) ;; TODO the rest is fragile and easily breaks when iolib changes behavior (and client-stream-fd (and (typep error 'iolib:socket-error) (eql client-stream-fd (isys:handle-of error))) ;; TODO signalling non stream-error conditions might be an iolib bug (and (typep error 'iolib.multiplex:poll-error) (eql client-stream-fd (iolib.multiplex:poll-error-fd error)))))))
this function keeps getting longer, but the bigger issue is that it highly depends on iolib's internal implementation.
is there any chance to add it to iolib's contracts that it only signals stream-error from stream calls like write-sequence? it could chain the original condition not to lose information...
or do you have some other suggestions?
On Mon, 2009-11-16 at 00:12 +0100, Attila Lendvai wrote:
Stelian, i think it's not against the rules to signal other exceptions than stream-error from sequence calls, but it's causing me more and more headaches.
the situation: i want to log errors happening while our web server is serving requests, but i want to keep the error log noise-free. network related errors are considered noise, so i have a function that decides whether the error is coming from the network stream connected to the client:
(def function is-error-from-client-stream? (error client-stream) (bind ((client-stream-fd (iolib:fd-of client-stream))) (or (and (typep error 'stream-error) (eq (stream-error-stream error) client-stream)) ;; TODO the rest is fragile and easily breaks when iolib changes behavior (and client-stream-fd (and (typep error 'iolib:socket-error) (eql client-stream-fd (isys:handle-of error))) ;; TODO signalling non stream-error conditions might be an iolib bug (and (typep error 'iolib.multiplex:poll-error) (eql client-stream-fd (iolib.multiplex:poll-error-fd error)))))))
this function keeps getting longer, but the bigger issue is that it highly depends on iolib's internal implementation.
is there any chance to add it to iolib's contracts that it only signals stream-error from stream calls like write-sequence? it could chain the original condition not to lose information...
or do you have some other suggestions?
I'd rather not do chaining because that would disallow the use of restarts. I think it would be better to make sure that only two error types can come out of a stream operation: CL:STREAM-ERRORs signaled by the Gray stream layer, and ISYS:SYSCALL-ERRORs signaled by low-level code.
I've logged it as https://bugs.launchpad.net/iolib/+bug/485392