[pkg-discuss] Re: Review 17478321 - NonLeafPackageException has no associated text
- From: Erik Trauschke <
- Cc: Yiteng Zhang <
- Subject: [pkg-discuss] Re: Review 17478321 - NonLeafPackageException has no associated text
- Date: Wed, 02 Oct 2013 10:43:39 -0700
On 09/24/13 03:19 PM, Yiteng Zhang wrote:
I add associated text to the class NonLeafPackageException in
api_errors.py. If it is on the right track, I would like to add text to
any other pkg exceptions that do not have associated text. Let me know
your comments. Thanks.
This works but please think about how this would look like if the error
gets printed on the screen. You are just separating them by a space.
Whenever you work on output which gets shown to the user you'll have to
imagine what this looks like when there is one FMRI printed, or 5 or
500. In your case it would look like this for a large number of dependents:
$ pkg something
Unable to remove 'storage/svm-mediator' due to the following packages
that depend on it: firstname.lastname@example.org,5.11-0.22:20111022T05245
7Z /email@example.com,5.11-4.1:20120802T163727Z /system/dsconfig-wi
Now tell me if you would be happy with an output like this.
Also, don't use "for d in ...", just use the str.join() function. You
actually have a good example of how to create a properly readable
message just a few lines below your change.