From: Mike Looijmans <mike.looijmans@topic.nl>
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH 1/1] bbclass: bb.fatal() clean up
Date: Wed, 08 May 2013 14:03:04 +0200 [thread overview]
Message-ID: <518A3EF8.20807@topic.nl> (raw)
In-Reply-To: <ee7a94478d58f0f43640cf9ae97018545a4ce6b6.1368002042.git.liezhi.yang@windriver.com>
On 05/08/2013 11:06 AM, Robert Yang wrote:
> The bb.fatal() is defined as:
>
> def fatal(*args):
> logger.critical(''.join(args))
> sys.exit(1)
>
> So anything after bb.fatal() in the same code block doesn't have any
> effect, e.g.:
>
> bb.fatal("%s_%s: %s" % (var, pkg, e))
> raise e
>
> The "raise e" should be removed.
Just some random thoughts that occurred to me when I read this:
The "terminate" effect would be obvious if "fatal" were an exception to
be raised instead of a function to call which does not really return. If
I'm not mistaken, "sys.exit(1)" actually just raises a SystemExit exception.
So instead of:
bb.fatal("something went wrong")
the syntax would become:
raise bb.Fatal("something went wrong")
Having typed this, the next random thought I got was that a thing like
catch Exception, e:
bb.fatal("Error: ", e)
isn't really adding anything useful, it just "translates" the exception,
logs its message, and then throws an obscure system exit exception
instead of the much more useful inner exception.
next prev parent reply other threads:[~2013-05-08 12:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-08 9:06 [PATCH 0/1] bbclass: bb.fatal() clean up Robert Yang
2013-05-08 9:06 ` [PATCH 1/1] " Robert Yang
2013-05-08 12:03 ` Mike Looijmans [this message]
2013-05-09 2:14 ` Robert Yang
2013-05-09 2:23 ` Chris Larson
2013-05-09 3:34 ` Robert Yang
2013-05-13 7:24 ` Mike Looijmans
2013-05-13 9:34 ` Robert Yang
2013-06-17 9:14 ` Robert Yang
2013-05-13 2:49 ` [PATCH 0/1] " Robert Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=518A3EF8.20807@topic.nl \
--to=mike.looijmans@topic.nl \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox