Skip to content

Commit 43e6577

Browse files
Copilotmathiasrw
andcommitted
Refactor: Use template literals for error messages
Improved code readability by replacing string concatenation with template literals in error messages. Co-authored-by: mathiasrw <[email protected]>
1 parent d7e04d8 commit 43e6577

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/70insert.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ yy.Insert.prototype.compile = function (databaseid) {
112112
// Validate that we have the right number of values for the columns
113113
if (values.length !== self.columns.length) {
114114
throw new Error(
115-
'The number of values (' +
116-
values.length +
117-
') does not match the number of columns (' +
118-
self.columns.length +
119-
'). ' +
115+
`The number of values (${values.length}) does not match the number of columns (${self.columns.length}). ` +
120116
'If using a subquery, use INSERT INTO ... SELECT instead of INSERT INTO ... VALUES (SELECT ...)'
121117
);
122118
}
@@ -157,11 +153,7 @@ yy.Insert.prototype.compile = function (databaseid) {
157153
// Validate that we have the right number of values for the table columns
158154
if (values.length !== table.columns.length) {
159155
throw new Error(
160-
'The number of values (' +
161-
values.length +
162-
') does not match the number of table columns (' +
163-
table.columns.length +
164-
'). ' +
156+
`The number of values (${values.length}) does not match the number of table columns (${table.columns.length}). ` +
165157
'If using a subquery, use INSERT INTO ... SELECT instead of INSERT INTO ... VALUES (SELECT ...)'
166158
);
167159
}

0 commit comments

Comments
 (0)