fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] api.run: fatal errors versus exceptions


From: Steve Hajducko
Subject: Re: [Fab-user] api.run: fatal errors versus exceptions
Date: Wed, 18 Jan 2012 22:07:33 -0800

( Sorry Paul for emailing twice, forgot to hit reply to all )

Why try and do it this way?

The tutorial lists a much simpler way:

with settings(warn_only=True):
       ThisRet = fabric.api.run(CmdString)
   if ThisRet.failed and not confirm("Tests failed. Continue anyway?"):
       abort("Aborting at user request.")

You don't need to use exception handling for these because fabric
already handles the exceptions and passes an object back to you that
you can handle and do what you want with.

On Wed, Jan 18, 2012 at 6:01 PM, Paul Hoffman <address@hidden> wrote:
> On Wed, Jan 18, 2012 at 10:50 AM, Jeff Forcier <address@hidden> wrote:
>> Hey Paul,
>>
>> Is the tutorial not clear enough on this topic? :)
>>
>>    http://docs.fabfile.org/en/1.3.3/tutorial.html#failure
>
> It is clear enough once I figured out the exception. For the record, I
> was using:
>                try:
>                        ThisRet = fabric.api.run(CmdString)
>                except Exception as e:
> Because Fabric is aborting, "Exception" doesn't catch it. It works
> when I change it to:
>                try:
>                        ThisRet = fabric.api.run(CmdString)
>                except BaseException as e:
>
> --Paul Hoffman
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fab-user



reply via email to

[Prev in Thread] Current Thread [Next in Thread]