ryandesign at macports.org
Tue Dec 18 10:51:05 PST 2012
On Dec 18, 2012, at 12:24, Jeremy Lavergne <jeremy at lavergne.gotdns.org> wrote:
>>>> Note that while "ui_error" prints the error message to the screen, it does not end processing the port. If you want the port to exit here, which I think you do, then you need "return -code error" like you had before.
>>> Yes, done that. I was under the impression that ui_error would do the same as “return -code error” and do some other things.
>> Maybe it should indeed behave like this. Why should the process be continued if an error arises?
> Best not to confuse functionality by blending printing and exiting together.
> `return -code error` actually returns from processing while `ui_error` (think `printf stderr`) is for presentation.
That's a good explanation: ui_* functions are for presentation at various levels: ui_msg, ui_error, ui_info, ui_debug.
We should not change how ui_error behaves because it would break all existing usage of ui_error in ports and base.
It's confusing enough that we already have two equivalent ways to exit out of a portfile: "return -code error" which I think is what we prefer, and simply "error" which some portfile authors are using instead. We don't need yet a third way to do the same thing.
More information about the macports-dev