10
10
11
11
package com .snowplowanalytics .snowplow .lakes
12
12
13
+ import java .net .UnknownHostException
14
+
13
15
import scala .reflect ._
14
16
17
+ import org .apache .hadoop .fs .azurebfs .contracts .exceptions .AbfsRestOperationException
18
+
15
19
import com .snowplowanalytics .snowplow .sources .kafka .{KafkaSource , KafkaSourceConfig }
16
20
import com .snowplowanalytics .snowplow .sinks .kafka .{KafkaSink , KafkaSinkConfig }
17
21
import com .snowplowanalytics .snowplow .azure .AzureAuthenticationCallbackHandler
@@ -35,5 +39,23 @@ object AzureApp extends LoaderApp[KafkaSourceConfig, KafkaSinkConfig](BuildInfo)
35
39
36
40
override def badSink : SinkProvider = KafkaSink .resource(_, classTag[SinkAuthHandler ])
37
41
38
- override def isDestinationSetupError : DestinationSetupErrorCheck = TableFormatSetupError .check
42
+ override def isDestinationSetupError : DestinationSetupErrorCheck = {
43
+ // Authentication issue (wrong OAuth endpoint, wrong client id, wrong secret..)
44
+ case e : AbfsRestOperationException if e.getStatusCode == - 1 =>
45
+ e.getErrorMessage()
46
+ // Wrong container name
47
+ case e : AbfsRestOperationException if e.getStatusCode() == 404 =>
48
+ s " ${e.getErrorMessage()} (e.g. wrong container name) "
49
+ // Service principal missing permissions for container (role assignement missing or wrong role)
50
+ case e : AbfsRestOperationException if e.getStatusCode() == 403 =>
51
+ s " Missing permissions for the destination (needs \" Storage Blob Data Contributor \" assigned to the service principal for the container) "
52
+ // Soft delete not disabled
53
+ case e : AbfsRestOperationException if e.getStatusCode() == 409 =>
54
+ " Blob soft delete must be disabled on the storage account"
55
+ case _ : UnknownHostException =>
56
+ " Wrong storage name"
57
+ // Exceptions common to the table format - Delta/Iceberg/Hudi
58
+ case TableFormatSetupError .check(t) =>
59
+ t
60
+ }
39
61
}
0 commit comments