Setting invalid widget attribute does not raise exception

Bug #1381891 reported by Michi Henning
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
unity-scopes-api (Ubuntu)
New
High
Unassigned

Bug Description

Suppose I do:

PreviewWidget desc("summary_col", "text");
desc.add_attribute_value("test", Variant("This is the text for the widget"));

Did you spot the error? The attribute being set is "test", but it should be "text". There is no indication that I'm doing something impossible, and I'm left scratching my head why nothing renders.

It might be better to raise InvalidArgumentException here?

Changed in unity-scopes-api (Ubuntu):
importance: Undecided → High
Revision history for this message
Paweł Stołowski (stolowski) wrote :

The problem we have is we deliberately decided not to do any validation on the scopes API side and leave it up to the unity (even the shell plugin doesn't care much about what's inside the preview widgets).

The downside is in many cases scope author is clueless if widget doesn't show up or look as expected.

On the upside, support for new widgets can be added to the shell or existing widgets can be enhanced to support new attributes without affecting the lower layers.

Now, the problem of not having a clue as a scope author if something goes wrong is and important issue, so perhaps we should look for a middle ground. How about adding a simple validation and only output cerr warnings if we see something we don't know (and never throw, unless we find cases where we really know thw widget is totally broken)?

Revision history for this message
Michi Henning (michihenning) wrote :

Writing something to the log seems sensible, yes. At least we'll leave a footprint behind that way.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.