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 @@ -733,14 +733,18 @@ function SqlPouch(opts: OpenDatabaseOptions, cb: (err: any) => void) {
733733
734734 api . _getLocal = ( id : string , callback : ( err : any , doc ?: any ) => void ) => {
735735 readTransaction ( async ( tx : Transaction ) => {
736- const sql = 'SELECT json, rev FROM ' + LOCAL_STORE + ' WHERE id=?'
737- const res = await tx . executeAsync ( sql , [ id ] )
738- if ( res . rows ?. length ) {
739- const item = res . rows . item ( 0 )
740- const doc = unstringifyDoc ( item . json , id , item . rev )
741- callback ( null , doc )
742- } else {
743- callback ( createError ( MISSING_DOC ) )
736+ try {
737+ const sql = 'SELECT json, rev FROM ' + LOCAL_STORE + ' WHERE id=?'
738+ const res = await tx . executeAsync ( sql , [ id ] )
739+ if ( res . rows ?. length ) {
740+ const item = res . rows . item ( 0 )
741+ const doc = unstringifyDoc ( item . json , id , item . rev )
742+ callback ( null , doc )
743+ } else {
744+ callback ( createError ( MISSING_DOC ) )
745+ }
746+ } catch ( e : any ) {
747+ handleSQLiteError ( e , callback )
744748 }
745749 } )
746750 }
You can’t perform that action at this time.
0 commit comments