File tree 3 files changed +13
-10
lines changed
3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 4
4
"node" : true ,
5
5
"es6" : true
6
6
},
7
- "parser" : " babel-eslint" ,
8
7
"parserOptions" : {
9
8
"ecmaVersion" : 9 ,
10
9
"sourceType" : " module"
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ function Backend({
13
13
onready,
14
14
transform,
15
15
onnotice,
16
- onnotify
16
+ onnotify,
17
+ error
17
18
} ) {
18
19
let rows = 0
19
20
@@ -119,7 +120,9 @@ function Backend({
119
120
function CopyData ( ) { /* No handling needed until implemented */ }
120
121
121
122
function ErrorResponse ( x ) {
122
- backend . error = errors . generic ( error ( x ) )
123
+ backend . query
124
+ ? ( backend . error = errors . generic ( parseError ( x ) ) )
125
+ : error ( errors . generic ( parseError ( x ) ) )
123
126
}
124
127
125
128
/* c8 ignore next */
@@ -142,8 +145,8 @@ function Backend({
142
145
143
146
function NoticeResponse ( x ) {
144
147
onnotice
145
- ? onnotice ( error ( x ) )
146
- : console . log ( error ( x ) ) // eslint-disable-line
148
+ ? onnotice ( parseError ( x ) )
149
+ : console . log ( parseError ( x ) ) // eslint-disable-line
147
150
}
148
151
149
152
function NoData ( ) { /* No handling needed */ }
@@ -153,7 +156,7 @@ function Backend({
153
156
try {
154
157
type !== 0 && onauth ( type , x )
155
158
} catch ( err ) {
156
- backend . error = err
159
+ error ( err )
157
160
}
158
161
}
159
162
@@ -212,12 +215,12 @@ function Backend({
212
215
backend . error = errors . notSupported ( 'CopyBothResponse' )
213
216
}
214
217
215
- function ReadyForQuery ( x ) {
218
+ function ReadyForQuery ( ) {
216
219
onready ( backend . error )
217
220
}
218
221
}
219
222
220
- function error ( x ) {
223
+ function parseError ( x ) {
221
224
const error = { }
222
225
let start = 5
223
226
for ( let i = 5 ; i < x . length - 1 ; i ++ ) {
Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ function Connection(options = {}) {
44
44
onnotify,
45
45
onnotice,
46
46
onready,
47
- onauth
47
+ onauth,
48
+ error
48
49
} )
49
50
50
51
return connection
@@ -131,7 +132,7 @@ function Connection(options = {}) {
131
132
? backend . query . result . count
132
133
: backend . query . result ) )
133
134
134
- backend . error = null
135
+ backend . query = backend . error = null
135
136
timeout && queries . length === 0 && idle ( )
136
137
137
138
if ( queries . length === 0 && ended )
You can’t perform that action at this time.
0 commit comments