File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -737,14 +737,18 @@ function SqlPouch(opts: OpenDatabaseOptions, cb: (err: any) => void) {
737737
738738 api . _getLocal = ( id : string , callback : ( err : any , doc ?: any ) => void ) => {
739739 readTransaction ( async ( tx : Transaction ) => {
740- const sql = 'SELECT json, rev FROM ' + LOCAL_STORE + ' WHERE id=?'
741- const res = await tx . executeAsync ( sql , [ id ] )
742- if ( res . rows ?. length ) {
743- const item = res . rows . item ( 0 )
744- const doc = unstringifyDoc ( item . json , id , item . rev )
745- callback ( null , doc )
746- } else {
747- callback ( createError ( MISSING_DOC ) )
740+ try {
741+ const sql = 'SELECT json, rev FROM ' + LOCAL_STORE + ' WHERE id=?'
742+ const res = await tx . executeAsync ( sql , [ id ] )
743+ if ( res . rows ?. length ) {
744+ const item = res . rows . item ( 0 )
745+ const doc = unstringifyDoc ( item . json , id , item . rev )
746+ callback ( null , doc )
747+ } else {
748+ callback ( createError ( MISSING_DOC ) )
749+ }
750+ } catch ( e : any ) {
751+ handleSQLiteError ( e , callback )
748752 }
749753 } )
750754 }
You can’t perform that action at this time.
0 commit comments