@cap-js/sqlite
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -7,2 +7,9 @@ # Changelog | ||
## [1.5.1](https://github.com/cap-js/cds-dbs/compare/sqlite-v1.5.0...sqlite-v1.5.1) (2024-02-16) | ||
### Fixed | ||
* **`sqlite`:** Retain Error object for unique constraint violation ([#446](https://github.com/cap-js/cds-dbs/issues/446)) ([d27ee79](https://github.com/cap-js/cds-dbs/commit/d27ee79b4c4eea8522bf5dd2a288638f54029567)) | ||
## [1.5.0](https://github.com/cap-js/cds-dbs/compare/sqlite-v1.4.0...sqlite-v1.5.0) (2024-02-02) | ||
@@ -9,0 +16,0 @@ |
@@ -194,3 +194,4 @@ const { SQLService } = require('@cap-js/db-service') | ||
// Otherwise they would be added as strings to json_objects. | ||
struct: expr => `${expr}->'$'`, // Association + Composition inherits from struct | ||
Association: expr => `${expr}->'$'`, | ||
struct: expr => `${expr}->'$'`, | ||
array: expr => `${expr}->'$'`, | ||
@@ -248,3 +249,3 @@ | ||
} catch (err) { | ||
throw _not_unique(err, 'ENTITY_ALREADY_EXISTS') || err | ||
throw _not_unique(err, 'ENTITY_ALREADY_EXISTS') | ||
} | ||
@@ -257,3 +258,3 @@ } | ||
} catch (err) { | ||
throw _not_unique(err, 'UNIQUE_CONSTRAINT_VIOLATION') || err | ||
throw _not_unique(err, 'UNIQUE_CONSTRAINT_VIOLATION') | ||
} | ||
@@ -264,3 +265,3 @@ } | ||
// function _not_null (err) { | ||
// if (err.code === "SQLITE_CONSTRAINT_NOTNULL") return Object.assign ({ | ||
// if (err.code === "SQLITE_CONSTRAINT_NOTNULL") return Object.assign (err, { | ||
// code: 'MUST_NOT_BE_NULL', | ||
@@ -274,3 +275,3 @@ // target: /\.(.*?)$/.exec(err.message)[1], // here we are even constructing OData responses, with .target | ||
if (err.message.match(/unique constraint/i)) | ||
return Object.assign({ | ||
return Object.assign(err, { | ||
originalMessage: err.message, // FIXME: required because of next line | ||
@@ -280,4 +281,5 @@ message: code, // FIXME: misusing message as code | ||
}) | ||
return err | ||
} | ||
module.exports = SQLiteService |
{ | ||
"name": "@cap-js/sqlite", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "CDS database service for SQLite", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/cap-js/cds-dbs/tree/main/sqlite#cds-database-service-for-sqlite", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30561
409