@@ -415,6 +415,17 @@ def get(self, id, subset=None):
415
415
416
416
417
417
class Importer (CliPlugin ):
418
+ def __init__ (self ):
419
+ self .__not_found_error_data = {"ext" : "" , "filename" : "" }
420
+
421
+ @property
422
+ def _not_found_error_data (self ):
423
+ return self .__not_found_error_data
424
+
425
+ @_not_found_error_data .setter
426
+ def _not_found_error_data_setter (self , val ):
427
+ self .__not_found_error_data = val
428
+
418
429
@classmethod
419
430
def detect (
420
431
cls ,
@@ -433,17 +444,17 @@ def find_sources(cls, path) -> List[Dict]:
433
444
def find_sources_with_params (cls , path , ** extra_params ) -> List [Dict ]:
434
445
return cls .find_sources (path )
435
446
436
- @classmethod
437
- def _generate_not_found_error (self , path ):
438
- return DatasetNotFoundError (path )
439
-
440
447
def __call__ (self , path , ** extra_params ):
441
448
if not path or not osp .exists (path ):
442
449
raise DatasetNotFoundError (path )
443
450
444
451
found_sources = self .find_sources_with_params (osp .normpath (path ), ** extra_params )
445
452
if not found_sources :
446
- raise self ._generate_not_found_error (path )
453
+ raise DatasetNotFoundError (
454
+ path ,
455
+ self ._not_found_error_data .get ("ext" , "" ),
456
+ self ._not_found_error_data .get ("filename" , "" ),
457
+ )
447
458
448
459
sources = []
449
460
for desc in found_sources :
@@ -508,6 +519,10 @@ def _find_sources_recursive(
508
519
)
509
520
if sources :
510
521
break
522
+
523
+ if not sources :
524
+ cls ._not_found_error_data = {"ext" : ext , "filename" : filename }
525
+
511
526
return sources
512
527
513
528
0 commit comments