@@ -170,8 +170,11 @@ class Manifest implements ConfigScope {
170170 .map(opts -> new Contributor (opts))
171171 .toList()
172172 }
173- catch ( ClassCastException | IllegalArgumentException e ){
174- throw new AbortOperationException (" Invalid config option `manifest.contributors` -- should be a list of maps" )
173+ catch ( IllegalArgumentException e ){
174+ throw new AbortOperationException (e. message)
175+ }
176+ catch ( ClassCastException e ){
177+ throw new AbortOperationException (" Invalid setting for `manifest.contributors` config option -- should be a list of maps" )
175178 }
176179 }
177180
@@ -208,17 +211,23 @@ class Manifest implements ConfigScope {
208211 affiliation = opts. affiliation as String
209212 email = opts. email as String
210213 github = opts. github as String
211- contribution = parseContributionTypes(opts. contribution)
214+ contribution = parseContributionTypes(opts. contribution as List< String > )
212215 orcid = opts. orcid as String
213216 }
214217
215- private List<ContributionType > parseContributionTypes (Object value ) {
216- if ( value == null )
218+ private List<ContributionType > parseContributionTypes (List< String > values ) {
219+ if ( values == null )
217220 return []
218- return (value as List<String > ). stream()
219- .map(c -> ContributionType . valueOf(c. toUpperCase()))
220- .sorted()
221- .toList()
221+ final result = new LinkedList<ContributionType > ()
222+ for ( final value : values ) {
223+ try {
224+ result. add(ContributionType . valueOf(value. toUpperCase()))
225+ }
226+ catch ( IllegalArgumentException e ) {
227+ throw new IllegalArgumentException (" Invalid contribution type '$value ' in `manifest.contributors` config option" )
228+ }
229+ }
230+ return result. toSorted()
222231 }
223232
224233 Map toMap () {
0 commit comments