Need an example of how to use "try" and "catch"
Pete
pete at mollysrevenge.com
Thu Mar 22 18:31:15 EDT 2012
Sorry to keep this thread going but I'm trying to figure out if I should be
using try/catch more, particularly for database calls.
As far as I know, you can tell if any of the standard rev db calls fail by
checking their returned value or the result. Are there circumstances where
that's not the case or does SQLYoga silent about errors?
I have experienced silent datagrid problems that were only revealed by
enclosing the datagrid access statements in try/catch.
Pete
On Thu, Mar 22, 2012 at 2:37 PM, Bernard Devlin <bdrunrev at gmail.com> wrote:
> I have been using the try/catch idiom for years. I like the structure
> it gives my code - visually it makes it very clear where I am
> expecting problematic sections to be. I rarely use 'finally'.
> However the problem has always been with interpreting the error codes
> that arise. For years I got round that by incorporating Mark
> Schonewille's errorLib in my stacks.
>
> Like you, I find that sqlYoga really needs try/catch. I did see
> somewhere else that Trevor recommended having some specific error
> handler implemented, but for me just wrapping the calls that go to the
> database in try/catch solves the problem.
>
> Bernard
>
> On Thu, Mar 22, 2012 at 8:25 PM, Bob Sneidar <bobs at twft.com> wrote:
> > No advantage per se, but I use sqlYoga and the only way to determine
> what went wrong is in a try catch statement as the libSQLYoga stack is
> locked.
> >
> > Bob
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
--
Pete
Molly's Revenge <http://www.mollysrevenge.com>
More information about the use-livecode
mailing list