On Feb 10, 2007, at 4:36 AM, Dave wrote:

Something like "revLastExternalError". By always setting this variable to any error messages from within the external you maintain standard behavior for functions and have a variable to check for errors:

Except that if the function was non-external then you'd still have to have different code paths?

You could define revLastExternalError (or some variable of your choice) as global and use it to report errors from any function. The trick of setting the "it" variable and "the result" in a function is something you can only do in an external so even if you go that route you would have to come up with a different solution for functions written in Revolution.

Another option might be to throw errors when they occur in functions which I think is what is happening if you set the error variable to true in an external.

I guess you could also go the route of always passing the variable that will contain the function result by reference and always returning the error at the end of the function.

function getSomeValue @pReturnValue, param1, param2
    local theError

... Do stuff to get value. If something goes wrong then put error string into theError

    return theError
end getSomeValue

To accomplish the same thing in an external function you would pass in the name of the variable and set it using SetVariable.

I'm really just thinking (typing) out loud on this but it is an issue I've been thinking about lately as I don't really have a standard means of reporting errors from functions. I find myself experimenting with different methods in my projects. All I know is I really don't like functions that can return a result that can be valid data or an error string.

Any other ideas?


--
Trevor DeVore
Blue Mango Learning Systems - www.bluemangolearning.com
[EMAIL PROTECTED]


_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to