Edgewall Software
Modify

Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#11427 closed enhancement (fixed)

Improve error message in exceptions raised by ExtensionOption and OrderedExtensionOption

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Milestone: 1.0.2
Component: general Version:
Severity: normal Keywords: config exception
Cc: Branch:
Release Notes:

Improved hint in error messages from ExtensionsOption and OrderedExtensionsOption.

API Changes:
Internal Changes:

Description

It was discussed in th:#10980 that we might improve the error message in the exceptions raised from ExtensionOption and OrderedExtensionOption when the Component is not active. For example:

ConfigurationError: Cannot find an implementation of the "IEmailSender" interface named "SmtpEmailSender". Please update the option announcer.email_sender in trac.ini.

ConfigurationError: Cannot find an implementation of the IEmailSender interface named SmtpEmailSender. Please check that the Component is enabled or update the option [announcer] email_sender in trac.ini.

Attachments (2)

t11427.patch (2.8 KB ) - added by Ryan J Ollos 10 years ago.
t11427.2.patch (3.1 KB ) - added by Ryan J Ollos 10 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 by Ryan J Ollos, 10 years ago

Milestone: 1.0.31.0.2
Owner: set to Ryan J Ollos
Status: newassigned

by Ryan J Ollos, 10 years ago

Attachment: t11427.patch added

comment:2 by Ryan J Ollos, 10 years ago

Proposed change can be found in attachment:t11427.patch. tt tags will be replaced with code tags on merge to trunk (#11094). The result is:

ExtensionOption:

Configuration Error

Cannot find an implementation of the ITicketGroupStatsProvider interface named DefaultTicketGroupStatsProvide. Please check that the Component is enabled or update the option [roadmap] stats_provider in trac.ini.

TracGuide — The Trac User and Administration Guide


OrderedExtensionOption:

Configuration Error

Cannot find implementation(s) of the IPermissionPolicy interface named MissingPermPolicyOne, MissingPermPolicyTwo. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini.

TracGuide — The Trac User and Administration Guide

Last edited 7 years ago by Ryan J Ollos (previous) (diff)

comment:3 by Ryan J Ollos, 10 years ago

I just noticed that the following are auto-linked:

ExtensionOption:ExtensionOption:
**ExtensionOption**ExtensionOption

but this one is not:

**ExtensionOption:**ExtensionOption:

comment:4 by Ryan J Ollos, 10 years ago

On second thought, the strings differ only by "… an implementation of …" - "… implementation(s) of …", so I will just make those the same and we will have one fewer string to translate.

Version 0, edited 10 years ago by Ryan J Ollos (next)

comment:5 by Ryan J Ollos, 10 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

I've modified the patch to add an entry for each implementation that is not found:

Configuration Error

Cannot find an implementation of the IPermissionPolicy interface named MissingPermPolicyOne. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini.

Cannot find an implementation of the IPermissionPolicy interface named MissingPermPolicyTwo. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini.

TracGuide — The Trac User and Administration Guide

The resulting diff of the pot file is:

  • trac/locale/messages.pot

    diff --git a/trac/locale/messages.pot b/trac/locale/messages.pot
    index cc09b90..05a70ca 100644
    a b msgstr ""  
    454454msgid "File '%(name)s' exists"
    455455msgstr ""
    456456
    457 #: trac/config.py:44
     457#: trac/config.py:45
    458458msgid "Configuration Error"
    459459msgstr ""
    460460
    461 #: trac/config.py:48
     461#: trac/config.py:49
    462462msgid "Look in the Trac log for more information."
    463463msgstr ""
    464464
    465 #: trac/config.py:273
     465#: trac/config.py:274
    466466#, python-format
    467467msgid "Error reading '%(file)s', make sure it is readable."
    468468msgstr ""
    469469
    470 #: trac/config.py:430
     470#: trac/config.py:431
    471471#, python-format
    472472msgid "[%(section)s] %(entry)s: expected integer, got %(value)s"
    473473msgstr ""
    474474
    475 #: trac/config.py:448
     475#: trac/config.py:449
    476476#, python-format
    477477msgid "[%(section)s] %(entry)s: expected float, got %(value)s"
    478478msgstr ""
    479479
    480 #: trac/config.py:621
     480#: trac/config.py:622
    481481msgid "Setting attribute is not allowed."
    482482msgstr ""
    483483
    484 #: trac/config.py:701
     484#: trac/config.py:702
    485485#, python-format
    486486msgid "[%(section)s] %(entry)s: expected one of (%(choices)s), got %(value)s"
    487487msgstr ""
    488488
    489 #: trac/config.py:734
     489#: trac/config.py:741 trac/config.py:778
    490490#, python-format
    491491msgid ""
    492 "Cannot find an implementation of the \"%(interface)s\" interface named "
    493 "\"%(implementation)s\".  Please update the option %(section)s.%(name)s in"
    494 " trac.ini."
     492"Cannot find an implementation of the %(interface)s interface named "
     493"%(implementation)s. Please check that the Component is enabled or update "
     494"the option %(option)s in trac.ini."
    495495msgstr ""
    496496
    497 #: trac/config.py:772
    498 #, python-format
    499 msgid ""
    500 "Cannot find implementation(s) of the \"%(interface)s\" interface named "
    501 "\"%(implementation)s\".  Please update the option %(section)s.%(name)s in"
    502 " trac.ini."
    503 msgstr ""
    504 
    505 #: trac/config.py:813 trac/config.py:826
     497#: trac/config.py:822 trac/config.py:835
    506498#, python-format
    507499msgid "Option '%(option)s' doesn't exist in section '%(section)s'"
    508500msgstr ""

by Ryan J Ollos, 10 years ago

Attachment: t11427.2.patch added

comment:6 by Ryan J Ollos, 10 years ago

Resolution: fixed
Status: closedreopened

Didn't mean to close this yet. I'm still just posting changes for review.

comment:7 by Ryan J Ollos, 10 years ago

Status: reopenedassigned

comment:8 by Jun Omae, 10 years ago

Looks good. But I like to show multiple component names in a error message, not each message. See [a54790de/jomae.git].


Configuration Error

Cannot find implementation(s) of the IPermissionPolicy interface named AlphaPolicy, BetaPolicy, ThetaPolicy. Please check that the Component is enabled or update the option [trac] permission_policies in trac.ini.

TracGuide — The Trac User and Administration Guide

in reply to:  8 ; comment:9 by Ryan J Ollos, 10 years ago

Replying to jomae:

Looks good. But I like to show multiple component names in a error message, not each message.

Would you suggest using the same error message for ExtensionOption as well, or having a slightly different message, as shown in comment:2? I tend to think it will be strange to use the same error message and suggest that implementation(s) could exist for an ExtensionOption.

in reply to:  9 comment:10 by Jun Omae, 10 years ago

Replying to rjollos:

Would you suggest using the same error message for ExtensionOption as well, or having a slightly different message, as shown in comment:2?

The message for OrderedExtensionOption in comment:2 is the same.

However, that generates a tt element for each component name, not one tt element.

<tt>AlphaPolicy, BetaPolicy, ThetaPolicy</tt>

<tt>AlphaPolicy</tt>, <tt>BetaPolicy</tt>, <tt>ThetaPolicy</tt>

I tend to think it will be strange to use the same error message and suggest that implementation(s) could exist for an ExtensionOption.

I understand your intention. But, if more than one missing components are in trac.ini, I confused and scared similar messages which are repeated, e.g. Cannot find … in trac.ini. Cannot find … in trac.ini. in comment:5.

comment:11 by Ryan J Ollos, 10 years ago

Resolution: fixed
Status: assignedclosed

Committed to 1.0-stable in [12430] and merged to trunk in [12431]. Replaced tt tags with code tags on trunk in [12432].

in reply to:  3 comment:12 by Ryan J Ollos, 7 years ago

Replying to Ryan J Ollos:

I just noticed that the following are auto-linked:

ExtensionOption:ExtensionOption:
**ExtensionOption**ExtensionOption

but this one is not:

**ExtensionOption:**ExtensionOption:

Reported in #12733.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.