@@ -13,6 +13,7 @@ namespace Adobe.Target.Client
1313 using System ;
1414 using System . Net ;
1515 using System . Threading . Tasks ;
16+ using Adobe . Target . Delivery . Client ;
1617 using Adobe . Target . Delivery . Model ;
1718 using Microsoft . Extensions . Logging ;
1819 using Polly ;
@@ -53,6 +54,7 @@ private TargetClientConfig(Builder builder)
5354 this . OnDeviceDecisioningReady = builder . OnDeviceDecisioningReady ;
5455 this . ArtifactDownloadSucceeded = builder . ArtifactDownloadSucceeded ;
5556 this . ArtifactDownloadFailed = builder . ArtifactDownloadFailed ;
57+ this . ExceptionFactory = builder . ExceptionFactory ;
5658 this . OnDeviceEnvironment = builder . OnDeviceEnvironment ;
5759 this . OnDeviceConfigHostname = builder . OnDeviceConfigHostname ;
5860 this . OnDeviceDecisioningPollingIntSecs = builder . OnDeviceDecisioningPollingIntSecs ;
@@ -140,6 +142,11 @@ private TargetClientConfig(Builder builder)
140142 /// </summary>
141143 public Action < Exception > ArtifactDownloadFailed { get ; }
142144
145+ /// <summary>
146+ /// Exception Factory delegate
147+ /// </summary>
148+ public ExceptionFactory ExceptionFactory { get ; }
149+
143150 /// <summary>
144151 /// OnDevice Environment
145152 /// </summary>
@@ -280,6 +287,11 @@ public Builder(string client, string organizationId)
280287 /// </summary>
281288 internal Action < Exception > ArtifactDownloadFailed { get ; private set ; }
282289
290+ /// <summary>
291+ /// Exception Factory delegate
292+ /// </summary>
293+ internal ExceptionFactory ExceptionFactory { get ; private set ; }
294+
283295 /// <summary>
284296 /// OnDevice Environment
285297 /// </summary>
@@ -452,6 +464,19 @@ public Builder SetArtifactDownloadFailed(Action<Exception> @delegate)
452464 return this ;
453465 }
454466
467+ /// <summary>
468+ /// Sets Exception Factory delegate<br/>
469+ /// Note: this will receive all raw Delivery API responses, <see cref="IApiResponse"/>
470+ /// Make sure to return <c>null</c> after handling any exceptions if you don't want these to be re-thrown
471+ /// </summary>
472+ /// <param name="factory"><see cref="ExceptionFactory"/> delegate</param>
473+ /// <returns><see cref="Builder"/> instance</returns>
474+ public Builder SetExceptionFactory ( ExceptionFactory factory )
475+ {
476+ this . ExceptionFactory = factory ;
477+ return this ;
478+ }
479+
455480 /// <summary>
456481 /// Sets OnDevice Environment <br/>
457482 /// Default: "production"
0 commit comments