Engine - use of python built-in exceptions in PL processing

Bug #1316786 reported by Steve McLellan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Murano
Fix Released
Medium
Stan Lagun

Bug Description

EDIT: may be duplicate of https://blueprints.launchpad.net/murano/+spec/throw-correct-exception

Within the PL processing (particular executor.py, expressions.py) there's use of Python built-in exceptions (SyntaxError, ValueError, TypeError). These exceptions are for use in tightly-defined scenarios, so while their use makes sense looking at their names, it causes confusion when debugging because developers (well, me, anyway) are used to seeing them in a different context.

I suggest adding to dsl/exceptions.py equivalents (DSLSyntaxError etc), and at the same time providing more diagnostic information, since the stacktraces are often not useful because they're tens of levels deep. As an example from executor.py L175, instead of:

if name not in arguments_scheme:
     raise TypeError()

Use:

if name not in arguments_scheme:
    raise DSLTypeError("'%s' is not in the recognized arguments (%s)" % (name, argument_scheme))

The calling code can turn this error into something else if necessary but preserve the information.

In addition, exception handling blocks that don't log a message should have a comment explaining how they are handling the error if it isn't obvious.

Changed in murano:
importance: Undecided → Medium
status: New → Confirmed
milestone: none → juno-1
Steve McLellan (sjmc7)
description: updated
Stan Lagun (slagun)
Changed in murano:
milestone: juno-1 → juno-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano (master)

Fix proposed to branch: master
Review: https://review.openstack.org/104508

Changed in murano:
assignee: nobody → Stan Lagun (slagun)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano (master)

Reviewed: https://review.openstack.org/104508
Committed: https://git.openstack.org/cgit/stackforge/murano/commit/?id=ac21005828da3b19c94879b34453b43c61f321d4
Submitter: Jenkins
Branch: master

commit ac21005828da3b19c94879b34453b43c61f321d4
Author: Stan Lagun <email address hidden>
Date: Thu Jul 3 14:24:41 2014 +0400

    Unit tests for contracts

    in addition to unit tests:
    * in MuranoObject parent property renamed to owner
    * fixed ownership of temporary method arguments
    * more descriptive exceptions in contracts and related places

    Change-Id: I4ee491c5428a4a64a21ccb5b1947acac386eb78f
    Closes-Bug: #1337225
    Partial-Bug: #1316786

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to murano (master)

Fix proposed to branch: master
Review: https://review.openstack.org/104627

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/104651

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to murano (master)

Reviewed: https://review.openstack.org/104627
Committed: https://git.openstack.org/cgit/stackforge/murano/commit/?id=65783894f1fbf3726bbd216f9b50081d62d15969
Submitter: Jenkins
Branch: master

commit 65783894f1fbf3726bbd216f9b50081d62d15969
Author: Stan Lagun <email address hidden>
Date: Thu Jul 3 21:53:03 2014 +0400

    Unit tests for method and property access

    Tests for method invocation in property access in different
    inheritance topologies (single inheritance, multiple inheritance,
     diamond inheritance)

    Also fixes invalid property resolution algorithm that failed for methods
    that could be found on several inheritance paths (diamond scheme)

    Change-Id: I68ceae8fcab839b230d2acef667982897d554011
    Closes-Bug: #1337458
    Partial-Bug: #1316786

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/104651
Committed: https://git.openstack.org/cgit/stackforge/murano/commit/?id=9a39c31cb985e84e7800bc1136430b08eea7f6dd
Submitter: Jenkins
Branch: master

commit 9a39c31cb985e84e7800bc1136430b08eea7f6dd
Author: Stan Lagun <email address hidden>
Date: Thu Jul 3 23:10:29 2014 +0400

    Unit tests for macro blocks

    Also:
     * fixes local variable scope for several macro
     * make thrown exceptions be more descriptive
     * parsing error happened when Limit for ParallelCode was integer (and not expression)
     * improved Break support

    Change-Id: Ie17240c2d343014ce3da9ddc6577cf93cf99b106
    Closes-Bug: #1337512
    Partial-Bug: #1316786

ruhe (ruhe)
Changed in murano:
milestone: juno-2 → juno-3
ruhe (ruhe)
Changed in murano:
milestone: juno-3 → juno-rc1
ruhe (ruhe)
Changed in murano:
milestone: juno-rc1 → none
Changed in murano:
status: In Progress → Fix Committed
milestone: none → kilo-2
Changed in murano:
status: Fix Committed → Fix Released
Changed in murano:
milestone: kilo-2 → 2015.1.0
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.