|
From: Ethan A M. <merritt@u.washington.edu> - 2007-10-13 02:56:50
|
The following query, and my response to it, appeared on the newsgroup: >>I am already using with success gnuplot and batch mode operation. The >>problem I am facing is how to understand if a plot was not performed >>correctly, when run as a batch job. >> >>I.e. when I issue this command "plot sin(x" I get a "')' expected" >>error, or when I give "plot ssin(x)" I get error "undefined function: >>ssin". >> >>Is there a safe way to grab all these errors? Something like a "return >>value" ? >No return value, sorry. >The closest I can think of is illustrated below >ierr = 1 >plot sin(x ; ierr=0 >print (ierr == 1) ? "failed" : "success" I am wondering if we can and should implement something of the sort automatically. It's easy to have int_error() set an error flag. The question is whether there is a single place, or a small number of places, where such a flag can be guaranteed to be reset before the next command is executed, yet leaves it available for testing? Alternatively we could allow the user to define an asynchronous error-handling function, and call it from int_error() if it exists. E.g.: #define error handler routine (must have this name) user_error_handler(x) = (saw_error = x) saw_error = 0 [some series of commands] print (saw_error != 0) ? "some error happened" : "OK" Any ideas? -- Ethan A Merritt |