|
104 | 104 |
|
105 | 105 | ). |
106 | 106 |
|
| 107 | +% the message sent to the user when a dependency is malformed |
| 108 | +user_message_malformed_dependency(D, Error):- |
| 109 | + current_output(Out), |
| 110 | + phrase_to_stream((portray_clause_(D), "is malformed: ", Error, "\n"), Out). |
| 111 | + |
| 112 | +% the message sent to the user when there is a validation error |
| 113 | +user_message_invalid_manifest(Error):- |
| 114 | + current_output(Out), |
| 115 | + phrase_to_stream(("The installation failed; cause:\n\t", Error, "\n"), Out). |
| 116 | + |
107 | 117 | % Is valid when there is 0 instance and the field is optional |
108 | 118 | has_a_field([], _, _, true, success). |
109 | 119 |
|
110 | 120 | % Is not valid when there is 0 instance and the field is not optional |
111 | 121 | has_a_field([], FieldName, PredicateForm, false, error(Es)):- |
112 | | - phrase(format_("the '~s' of the package is not defined or does not have the a predicate of the form '~s'", [FieldName, PredicateForm]), Es). |
| 122 | + phrase(format_("the '~s' of the package is not defined or does not have the a predicate of the form '~s'", [FieldName, PredicateForm]), Es), |
| 123 | + user_message_invalid_manifest(Es). |
113 | 124 |
|
114 | 125 | % Is valid when there is one instance of the field and the field value has the correct type |
115 | 126 | has_a_field([_], _, _, _, success). |
116 | 127 |
|
117 | 128 | % Is not valid when there are multiple instances of the field |
118 | 129 | has_a_field([_,_|_], FieldName, _, _, error(Es)):- |
119 | | - phrase(format_("the package has multiple '~s'", [FieldName]), Es). |
| 130 | + phrase(format_("the package has multiple '~s'", [FieldName]), Es), |
| 131 | + user_message_invalid_manifest(Es). |
120 | 132 |
|
121 | 133 | has_valid_name(Manifest, Result):- |
122 | 134 | phrase(pattern_in_list(Manifest, name_t), S), |
|
0 commit comments