#773 closed enhancement (fixed)
Explicit DatabaseNotFoundError exception
Reported by: | German M. Bravo | Owned by: | Olly Betts |
---|---|---|---|
Priority: | normal | Milestone: | 1.4.10 |
Component: | Library API | Version: | |
Severity: | normal | Keywords: | |
Cc: | vaibhavkansagara249@… | Blocked By: | |
Blocking: | Operating System: | All |
Description (last modified by )
Please add an explicit exception for when a database doesn't exist: DatabaseNotFoundError
(instead of just DatabaseOpeningError
)
Such DatabaseNotFoundError
could (and maybe should) inherit from DatabaseOpeningError
for backward compatibility.
Change History (9)
comment:1 by , 6 years ago
Type: | defect → enhancement |
---|
comment:2 by , 6 years ago
Component: | Other → Library API |
---|---|
Description: | modified (diff) |
Keywords: | GoodFirstBug added |
Milestone: | → 1.5.0 |
comment:3 by , 6 years ago
comment:4 by , 6 years ago
@olly,
To my knowledge this involves:
1)Creating a new class DatabaseNotFoundError
in error.h file which inherits DatabaseOpeningError
class.
2)Replace all occurrences of DatabaseOpeningError
in the code where suitably database is not existing. Specifically i found those occurrences in two files namely dbcheck.cc and dbfactory.cc in the xapian-core/backends.
Can you guide me furthur.
comment:5 by , 6 years ago
Pretty much.
Essentially anywhere that throws DatabaseOpeningError
currently needs checking to see if that ought to instead throw the new DatabaseNotFoundError
.
But also, some places that currently catch DatabaseOpeningError
should be updated correspondingly (especially in the testsuite - note there's a TEST_EXCEPTION(...)
macro there as well as explicit catch
). The code will still work without this change (since DatabaseNotFoundError
is a subclass of DatabaseOpeningError
) but we want to have test coverage that the new exception is thrown when it should be.
comment:6 by , 6 years ago
Cc: | added |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:7 by , 6 years ago
Keywords: | GoodFirstBug removed |
---|---|
Milestone: | 1.5.0 → 1.4.10 |
Owner: | changed from | to
Status: | assigned → new |
Fix on git master by 6ba3bf4b1254dadbf3ea4d8c00d3556bd373169f, thanks.
I think we should consider backporting this to 1.4.x as the change is compatible for code catching DatabaseOpeningError
, so setting milestone for that and taking ownership.
comment:8 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Backported for 1.4.10 in a4af7a61d4dff7a6ef44b537348091dc4a229da6.
comment:9 by , 5 years ago
I added a pull request to complement this with two missing points where I've found DatabaseNotFoundError
is needed: https://github.com/xapian/xapian/pull/258
i am working on this one.