Skip to main content

[pkg-discuss] Re: Review 17478321 - NonLeafPackageException has no associated text

  • From: Erik Trauschke < >
  • To:
  • Cc: Yiteng Zhang < >
  • Subject: [pkg-discuss] Re: Review 17478321 - NonLeafPackageException has no associated text
  • Date: Wed, 02 Oct 2013 10:43:39 -0700

Hi Yiteng,

On 09/24/13 03:19 PM, Yiteng Zhang wrote:
Hi all,

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.

https://ips.java.net/webrev/yitezhan/17478321

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: system/manual/locale@4.0.0,5.11-0.22:20111022T05245
7Z /system/install@4.0.0,5.11-4.1:20120802T163727Z /system/dsconfig-wi
zard@4.0.0,5.11-0.22.1:20111115T010932Z system/core@4.1,5.11-4.1:20130
801T174031Z ...

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.

Erik



[pkg-discuss] Re: Review 17478321 - NonLeafPackageException has no associated text

Erik Trauschke 10/02/2013

[pkg-discuss] Re: Review 17478321 - NonLeafPackageException has no associated text

Erik Trauschke 10/02/2013

[pkg-discuss] Re: Review 17478321 - NonLeafPackageException has no associated text

Yiteng Zhang 10/03/2013

Message not available

Message not available

[pkg-discuss] Re: Fwd: Re: Re: Review 17478321 - NonLeafPackageException has no associated text

Yiteng Zhang 10/26/2013
 
 
Close
loading
Please Confirm
Close