Skip to content

Commit

Permalink
Merge pull request #155 from rjmurillo/hotfix/8.0.1
Browse files Browse the repository at this point in the history
Catch `DeniedOrNotExistException` when accessing field during map
  • Loading branch information
rjmurillo authored Jul 26, 2017
2 parents 9224180 + d873382 commit d5e1365
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Qwiq.Mapper/Attributes/AttributeMapperStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,18 @@ protected internal virtual void MapImpl(Type targetWorkItemType, IWorkItem sourc
var fieldName = a.FieldName;
var convert = a.RequireConversion;
var nullSub = a.NullSubstitute;
var fieldValue = sourceWorkItem[fieldName];
object fieldValue;
try
{
fieldValue = sourceWorkItem[fieldName];
}
catch (DeniedOrNotExistException e)
{
var tm = new TypePair(sourceWorkItem, targetWorkItemType);
var pm = new PropertyMap(property, fieldName);
var message = $"Unable to get field value on {sourceWorkItem.Id}.";
throw new AttributeMapException(message, e, tm, pm);
}

AssignFieldValue(targetWorkItemType, sourceWorkItem, targetWorkItem, property, fieldName, convert, nullSub, fieldValue);
}
Expand Down

0 comments on commit d5e1365

Please sign in to comment.