pg-promise 8.7.1 → 8.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/errors/paramQuery.js +11 -18
- package/lib/errors/prepared.js +11 -18
- package/lib/errors/queryFile.js +12 -19
- package/lib/errors/queryResult.js +12 -18
- package/package.json +2 -2
package/lib/errors/paramQuery.js
CHANGED
|
@@ -43,27 +43,20 @@ const npm = {
|
|
|
43
43
|
*
|
|
44
44
|
* @see ParameterizedQuery
|
|
45
45
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
class ParameterizedQueryError extends Error {
|
|
47
|
+
constructor(error, ps) {
|
|
48
|
+
const isQueryFileError = error instanceof npm.QueryFileError;
|
|
49
|
+
const message = isQueryFileError ? 'Failed to initialize \'text\' from a QueryFile.' : error;
|
|
50
|
+
super(message);
|
|
51
|
+
this.name = this.constructor.name;
|
|
52
|
+
if (isQueryFileError) {
|
|
53
|
+
this.error = error;
|
|
54
|
+
}
|
|
55
|
+
this.result = ps;
|
|
56
|
+
Error.captureStackTrace(this, this.constructor);
|
|
55
57
|
}
|
|
56
|
-
this.result = ps;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
ParameterizedQueryError.prototype = Object.create(Error.prototype, {
|
|
60
|
-
constructor: {
|
|
61
|
-
value: ParameterizedQueryError,
|
|
62
|
-
writable: true,
|
|
63
|
-
configurable: true
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
60
|
/**
|
|
68
61
|
* @method errors.ParameterizedQueryError#toString
|
|
69
62
|
* @description
|
package/lib/errors/prepared.js
CHANGED
|
@@ -43,27 +43,20 @@ const npm = {
|
|
|
43
43
|
*
|
|
44
44
|
* @see PreparedStatement
|
|
45
45
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
class PreparedStatementError extends Error {
|
|
47
|
+
constructor(error, ps) {
|
|
48
|
+
const isQueryFileError = error instanceof npm.QueryFileError;
|
|
49
|
+
const message = isQueryFileError ? 'Failed to initialize \'text\' from a QueryFile.' : error;
|
|
50
|
+
super(message);
|
|
51
|
+
this.name = this.constructor.name;
|
|
52
|
+
if (isQueryFileError) {
|
|
53
|
+
this.error = error;
|
|
54
|
+
}
|
|
55
|
+
this.result = ps;
|
|
56
|
+
Error.captureStackTrace(this, this.constructor);
|
|
55
57
|
}
|
|
56
|
-
this.result = ps;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
PreparedStatementError.prototype = Object.create(Error.prototype, {
|
|
60
|
-
constructor: {
|
|
61
|
-
value: PreparedStatementError,
|
|
62
|
-
writable: true,
|
|
63
|
-
configurable: true
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
60
|
/**
|
|
68
61
|
* @method errors.PreparedStatementError#toString
|
|
69
62
|
* @description
|
package/lib/errors/queryFile.js
CHANGED
|
@@ -46,28 +46,21 @@ const npm = {
|
|
|
46
46
|
* @see QueryFile
|
|
47
47
|
*
|
|
48
48
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
this.
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
class QueryFileError extends Error {
|
|
50
|
+
constructor(error, qf) {
|
|
51
|
+
const isSqlError = error instanceof npm.minify.SQLParsingError;
|
|
52
|
+
const message = isSqlError ? 'Failed to parse the SQL.' : error.message;
|
|
53
|
+
super(message);
|
|
54
|
+
this.name = this.constructor.name;
|
|
55
|
+
if (isSqlError) {
|
|
56
|
+
this.error = error;
|
|
57
|
+
}
|
|
58
|
+
this.file = qf.file;
|
|
59
|
+
this.options = qf.options;
|
|
60
|
+
Error.captureStackTrace(this, this.constructor);
|
|
58
61
|
}
|
|
59
|
-
this.file = qf.file;
|
|
60
|
-
this.options = qf.options;
|
|
61
62
|
}
|
|
62
63
|
|
|
63
|
-
QueryFileError.prototype = Object.create(Error.prototype, {
|
|
64
|
-
constructor: {
|
|
65
|
-
value: QueryFileError,
|
|
66
|
-
writable: true,
|
|
67
|
-
configurable: true
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
64
|
/**
|
|
72
65
|
* @method errors.QueryFileError#toString
|
|
73
66
|
* @description
|
|
@@ -127,25 +127,19 @@ const errorMessages = [
|
|
|
127
127
|
* {@link Database#oneOrNone oneOrNone}, {@link Database#many many}
|
|
128
128
|
*
|
|
129
129
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
QueryResultError.prototype = Object.create(Error.prototype, {
|
|
143
|
-
constructor: {
|
|
144
|
-
value: QueryResultError,
|
|
145
|
-
writable: true,
|
|
146
|
-
configurable: true
|
|
130
|
+
class QueryResultError extends Error {
|
|
131
|
+
constructor(code, result, query, values) {
|
|
132
|
+
const message = errorMessages[code].message;
|
|
133
|
+
super(message);
|
|
134
|
+
this.name = this.constructor.name;
|
|
135
|
+
this.code = code;
|
|
136
|
+
this.result = result;
|
|
137
|
+
this.query = query;
|
|
138
|
+
this.values = values;
|
|
139
|
+
this.received = result.rows.length;
|
|
140
|
+
Error.captureStackTrace(this, this.constructor);
|
|
147
141
|
}
|
|
148
|
-
}
|
|
142
|
+
}
|
|
149
143
|
|
|
150
144
|
/**
|
|
151
145
|
* @method errors.QueryResultError#toString
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-promise",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.2",
|
|
4
4
|
"description": "Promises interface for PostgreSQL",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "typescript/pg-promise.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"assert-options": "0.1.3",
|
|
45
45
|
"manakin": "0.5.2",
|
|
46
46
|
"pg": "7.11.0",
|
|
47
|
-
"pg-minify": "1.
|
|
47
|
+
"pg-minify": "1.2.0",
|
|
48
48
|
"spex": "2.2.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|