eip-cloud-services 1.1.11 → 1.1.12

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/mysql.js +10 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eip-cloud-services",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "Houses a collection of helpers for connecting with Cloud services.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/mysql.js CHANGED
@@ -27,9 +27,16 @@ const newQuery = ( connection, query ) => new Promise ( ( resolve, reject ) => {
27
27
  connection.query ( query, ( error, results, fields ) => {
28
28
  connection.release ();
29
29
  if ( error ) {
30
- console.error ( error );
31
- console.error ( `There was a problem with query: ${ query }` );
32
- reject ( `There was a problem with query: ${ query }` );
30
+ const MAX_ERROR_LENGTH = 500;
31
+ const MAX_QUERY_LENGTH = 300;
32
+
33
+ const shortError = (error?.stack || error?.message || String(error)).slice(0, MAX_ERROR_LENGTH);
34
+ const shortQuery = query.slice(0, MAX_QUERY_LENGTH);
35
+
36
+ console.error("Query Error:", shortError);
37
+ console.error("Truncated Query:", shortQuery);
38
+
39
+ reject(`There was a problem with query: ${shortError}`);
33
40
  }
34
41
  else {
35
42
  resolve ( results );