- universe.contents[element].set(facet, value)
- message = ("You have successfully (re)set the \"" + facet
- + "\" facet of element \"" + element
- + "\". Try \"show element " +
- element + "\" for verification.")
+ try:
+ universe.contents[element].set(facet, value)
+ except PermissionError:
+ message = ('The "%s" element is kept in read-only file '
+ '"%s" and cannot be altered.' %
+ (element, universe.contents[
+ element].origin.source))
+ except ValueError:
+ message = ('Value "%s" of type "%s" cannot be coerced '
+ 'to the correct datatype for facet "%s".' %
+ (value, type(value), facet))
+ else:
+ message = ('You have successfully (re)set the "' + facet
+ + '" facet of element "' + element
+ + '". Try "show element ' +
+ element + '" for verification.')