@@ -24,9 +24,6 @@ type TableResolver func(ctx context.Context, meta ClientMeta, parent *Resource,
2424
2525type RowResolver func (ctx context.Context , meta ClientMeta , resource * Resource ) error
2626
27- // Classify error and return it's severity and type
28- type IgnoreErrorFunc func (err error ) (bool , string )
29-
3027type Tables []* Table
3128
3229type Table struct {
@@ -40,8 +37,6 @@ type Table struct {
4037 Relations Tables `json:"relations"`
4138 // Resolver is the main entry point to fetching table data and
4239 Resolver TableResolver `json:"-"`
43- // IgnoreError is a function that classifies error and returns it's severity and type
44- IgnoreError IgnoreErrorFunc `json:"-"`
4540 // Multiplex returns re-purposed meta clients. The sdk will execute the table with each of them
4641 Multiplex func (meta ClientMeta ) []ClientMeta `json:"-"`
4742 // PostResourceResolver is called after all columns have been resolved, but before the Resource is sent to be inserted. The ordering of resolvers is:
@@ -162,34 +157,23 @@ func (t Table) Resolve(ctx context.Context, meta ClientMeta, syncTime time.Time,
162157 go func () {
163158 defer func () {
164159 if err := recover (); err != nil {
160+ sentry .WithScope (func (scope * sentry.Scope ) {
161+ scope .SetTag ("table" , t .Name )
162+ sentry .CurrentHub ().Recover (err )
163+ })
165164 stack := string (debug .Stack ())
166165 meta .Logger ().Error ().Interface ("error" , err ).Str ("table_name" , t .Name ).TimeDiff ("duration" , time .Now (), startTime ).Str ("stack" , stack ).Msg ("table resolver finished with panic" )
167166 }
168167 close (res )
169168 }()
170169 meta .Logger ().Debug ().Str ("table_name" , t .Name ).Msg ("table resolver started" )
171170 if err := t .Resolver (ctx , meta , parent , res ); err != nil {
172- if t .IgnoreError != nil {
173- if ignore , errType := t .IgnoreError (err ); ignore {
174- meta .Logger ().Debug ().Stack ().Str ("table_name" , t .Name ).TimeDiff ("duration" , time .Now (), startTime ).Str ("error_type" , errType ).Err (err ).Msg ("table resolver finished with error" )
175- return
176- }
177- }
178- sentry .WithScope (func (scope * sentry.Scope ) {
179- scope .SetTag ("table" , t .Name )
180- scope .SetLevel (sentry .LevelError )
181- sentry .CaptureMessage (err .Error ())
182- })
183171 meta .Logger ().Error ().Str ("table_name" , t .Name ).TimeDiff ("duration" , time .Now (), startTime ).Err (err ).Msg ("table resolver finished with error" )
184172 return
185173 }
186174 meta .Logger ().Debug ().Str ("table_name" , t .Name ).TimeDiff ("duration" , time .Now (), startTime ).Msg ("table resolver finished successfully" )
187175 }()
188176 totalResources := 0
189- // we want to check for data integrity
190- // in the future we can do that as an optinoal feature via a flag
191- // pks := map[string]bool{}
192- // each result is an array of interface{}
193177 for elem := range res {
194178 objects := helpers .InterfaceSlice (elem )
195179 if len (objects ) == 0 {
@@ -214,11 +198,6 @@ func (t Table) Resolve(ctx context.Context, meta ClientMeta, syncTime time.Time,
214198 meta .Logger ().Trace ().Str ("table_name" , t .Name ).Msg ("post resource resolver finished successfully" )
215199 }
216200 }
217- // if pks[resource.PrimaryKeyValue()] {
218- // meta.Logger().Error().Str("table_name", t.Name).Str("primary_key", resource.PrimaryKeyValue()).Msg("duplicate primary key found")
219- // } else {
220- // pks[resource.PrimaryKeyValue()] = true
221- // }
222201 resolvedResources <- resource
223202 for _ , rel := range t .Relations {
224203 totalResources += rel .Resolve (ctx , meta , syncTime , resource , resolvedResources )
0 commit comments