[CONJS-165] Adding initial message error value on Error object. Created: 2021-03-22  Updated: 2021-06-08  Resolved: 2021-06-04

Status: Closed
Project: MariaDB Connector/node.js
Component/s: other
Affects Version/s: None
Fix Version/s: 2.5.4, 3.0.0-beta

Type: Task Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

Driver throw SqlError object defined like this :

export interface SqlError extends Error {
  /**
   * Either a MySQL server error (e.g. 'ER_ACCESS_DENIED_ERROR'),
   * a node.js error (e.g. 'ECONNREFUSED') or an internal error
   * (e.g. 'PROTOCOL_CONNECTION_LOST').
   */
  code: string | null;
 
  /**
   * The error number for the error code
   */
  errno: number;
 
  /**
   * The sql state
   */
  sqlState?: string | null;
 
  /**
   * Boolean, indicating if this error is terminal to the connection object.
   */
  fatal: boolean;
}

extending Error with message value.
Problem is that message as additional value added :
example 'My error label' => message will be `(conn=5149, no: 1644, SQLState: 45000) My error label` + sql + stack

This consist to adding 2 properties : initial message error and sql.



 Comments   
Comment by Diego Dupin [ 2021-06-08 ]

SQLError have now 2 additional fields :

/**

  • original error message value
    */
    text: string | null;

/**

  • The sql command associate
    */
    sql: string | null;
Generated at Thu Feb 08 03:23:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.