From rlpowell at digitalkingdom.org Thu Oct 2 20:27:53 2008 From: rlpowell at digitalkingdom.org (Robin Lee Powell) Date: Thu, 2 Oct 2008 13:27:53 -0700 Subject: [cl-selenium-devel] Better error handling, please. Message-ID: <20081002202753.GH16572@digitalkingdom.org> cl-selenium's response to me having forgotten to start selenium-server is: debugger invoked on a SIMPLE-ERROR in thread #: Error during processing of --eval option (LOAD #P"sert-spec.cl"): end of file on # Could that maybe be a little less opaque? :) -Robin -- Lojban Reason #17: http://en.wikipedia.org/wiki/Buffalo_buffalo Proud Supporter of the Singularity Institute - http://singinst.org/ http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ From rlpowell at digitalkingdom.org Wed Oct 15 00:59:11 2008 From: rlpowell at digitalkingdom.org (Robin Lee Powell) Date: Tue, 14 Oct 2008 17:59:11 -0700 Subject: [cl-selenium-devel] Better error handling, please. In-Reply-To: <20081002202753.GH16572@digitalkingdom.org> References: <20081002202753.GH16572@digitalkingdom.org> Message-ID: <20081015005911.GK10637@digitalkingdom.org> On Thu, Oct 02, 2008 at 01:27:53PM -0700, Robin Lee Powell wrote: > > cl-selenium's response to me having forgotten to start > selenium-server is: > > debugger invoked on a SIMPLE-ERROR in thread #: > Error during processing of --eval option (LOAD #P"sert-spec.cl"): > > end of file on # > > Could that maybe be a little less opaque? :) Did it myself: *** cl-selenium-0.4-orig/iedoc.lisp 2008-10-14 17:27:36.000000000 -0700 --- cl-selenium-0.4/iedoc.lisp 2008-10-14 17:58:25.000000000 -0700 *************** *** 150,155 **** --- 150,156 ---- (description c))))) (defun execute (url parameters &optional return-type) + (handler-case (multiple-value-bind (reply status-code headers reply-from stream some-bool reason) (drakma:http-request url :method :get :parameters parameters) (declare (ignore headers reply-from stream some-bool)) *************** *** 160,166 **** (convert-result (subseq reply (min 3 (length reply))) return-type)) ((starts-with reply "ERROR:") (let ((err (second (split-sequence:split-sequence #\: reply)))) ! (error 'execution-error :description err)))))) (defun convert-function (iedoc-function) (let ((function-name (convert-function-name (iedoc-function-name iedoc-function))) --- 161,169 ---- (convert-result (subseq reply (min 3 (length reply))) return-type)) ((starts-with reply "ERROR:") (let ((err (second (split-sequence:split-sequence #\: reply)))) ! (error 'execution-error :description err))))) ! (error (cond-val) ! (error "Selenium RC can't talk to the Selenium server; is it running?~%~% Specific error: ~A~%~%" cond-val)))) (defun convert-function (iedoc-function) (let ((function-name (convert-function-name (iedoc-function-name iedoc-function))) -Robin -- They say: "The first AIs will be built by the military as weapons." And I'm thinking: "Does it even occur to you to try for something other than the default outcome?" -- http://shorl.com/tydruhedufogre http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/ From rlpowell at digitalkingdom.org Wed Oct 15 02:10:52 2008 From: rlpowell at digitalkingdom.org (Robin Lee Powell) Date: Tue, 14 Oct 2008 19:10:52 -0700 Subject: [cl-selenium-devel] Optional execution errors. Message-ID: <20081015021052.GA12759@digitalkingdom.org> I find it vastly annoying for execution errors to, well, throw errors, because then my test framework doesn't get to tell me *where* the error occured. Arguably a bug in my test framework, but I fixed it in Selenium anyways, by making an overrideable error routine: diff -C3 -w -r cl-selenium-0.4-orig/iedoc.lisp cl-selenium-0.4/iedoc.lisp *** cl-selenium-0.4-orig/iedoc.lisp 2008-10-14 17:27:36.000000000 -0700 --- cl-selenium-0.4/iedoc.lisp 2008-10-14 19:02:47.000000000 -0700 *************** *** 160,166 **** (convert-result (subseq reply (min 3 (length reply))) return-type)) ((starts-with reply "ERROR:") (let ((err (second (split-sequence:split-sequence #\: reply)))) ! (error 'execution-error :description err)))))) (defun convert-function (iedoc-function) (let ((function-name (convert-function-name (iedoc-function-name iedoc-function))) --- 160,167 ---- (convert-result (subseq reply (min 3 (length reply))) return-type)) ((starts-with reply "ERROR:") (let ((err (second (split-sequence:split-sequence #\: reply)))) ! (funcall *selenium-execution-error-func* :description err) ! ))))) (defun convert-function (iedoc-function) (let ((function-name (convert-function-name (iedoc-function-name iedoc-function))) *************** *** 184,186 **** --- 185,194 ---- defaults to this special variable. You can bind a selenium session to this variable and use those functions without providing an explicit session each time.") + + (defvar *selenium-execution-error-func* + (lambda (desc err) + (error 'execution-error :description err)) + "This is the function that is run to create Selenium execution errors. + Replace it to get different error handling.") + -Robin -- They say: "The first AIs will be built by the military as weapons." And I'm thinking: "Does it even occur to you to try for something other than the default outcome?" -- http://shorl.com/tydruhedufogre http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/