@@ -31,6 +31,9 @@ from libcpp.memory cimport shared_ptr, make_shared, unique_ptr
3131
3232import datetime
3333
34+ class NotFound (RuntimeError ):
35+ pass
36+
3437# ########################
3538# Blob #
3639# ########################
@@ -392,13 +395,13 @@ cdef class FilePy:
392395 The Article object
393396 Raises
394397 ------
395- RuntimeError
398+ NotFound
396399 If an article with the provided long url is not found in the file
397400 """
398401 # Read to a zim::Article
399402 cdef wrapper.Article art = self .c_file.getArticleByUrl(url.encode(' UTF-8' ))
400403 if not art.good():
401- raise RuntimeError (" Article not found for url" )
404+ raise NotFound (" Article not found for url" )
402405
403406 article = ReadArticle.from_read_article(art)
404407 return article
@@ -413,12 +416,12 @@ cdef class FilePy:
413416 article = self .get_article(f" M/{name}" )
414417 return article.content
415418
416- def get_article_by_id (self , id ):
419+ def get_article_by_id (self , article_id ):
417420 """ Get a ZimFileArticle with a copy of the file article by article id.
418421
419422 Parameters
420423 ----------
421- id : int
424+ article_id : int
422425 The id of the article
423426 Returns
424427 -------
@@ -427,13 +430,15 @@ cdef class FilePy:
427430 Raises
428431 ------
429432 RuntimeError
433+ If there is a problem in retrieving article (ex: id is out of bound)
434+ NotFound
430435 If an article with the provided id is not found in the file
431436 """
432437
433438 # Read to a zim::Article
434- cdef wrapper.Article art = self .c_file.getArticle(< int > id )
439+ cdef wrapper.Article art = self .c_file.getArticle(< int > article_id )
435440 if not art.good():
436- raise RuntimeError (" Article not found for id" )
441+ raise NotFound (" Article not found for id" )
437442
438443 article = ReadArticle.from_read_article(art)
439444 return article
0 commit comments