Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#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 Olly Betts)

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 German M. Bravo, 4 years ago

Type: defectenhancement

comment:2 by Olly Betts, 4 years ago

Component: OtherLibrary API
Description: modified (diff)
Keywords: GoodFirstBug added
Milestone: 1.5.0

comment:3 by Vaibhav Kansagara, 4 years ago

i am working on this one.

comment:4 by Vaibhav Kansagara, 4 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 and in the xapian-core/backends. Can you guide me furthur.

Last edited 4 years ago by Vaibhav Kansagara (previous) (diff)

comment:5 by Olly Betts, 4 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 Vaibhav Kansagara, 4 years ago

Cc: vaibhavkansagara249@… added
Owner: changed from Olly Betts to Vaibhav Kansagara
Status: newassigned

comment:7 by Olly Betts, 4 years ago

Keywords: GoodFirstBug removed
Owner: changed from Vaibhav Kansagara to Olly Betts
Status: assignednew

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 Olly Betts, 4 years ago

Resolution: fixed
Status: newclosed

Backported for 1.4.10 in a4af7a61d4dff7a6ef44b537348091dc4a229da6.

comment:9 by German M. Bravo, 4 years ago

I added a pull request to complement this with two missing points where I've found DatabaseNotFoundError is needed:

Note: See TracTickets for help on using tickets.