@@ -86,7 +86,7 @@ class PuddySqlInstance extends PuddySqlEngine {
8686 * @param {boolean } state - Set to `true` to enable colors, or `false` to disable.
8787 */
8888 setConsoleColors ( state ) {
89- if ( typeof state !== 'boolean' ) throw new Error ( 'state must be a boolean' ) ;
89+ if ( typeof state !== 'boolean' ) throw new TypeError ( 'state must be a boolean' ) ;
9090 this . #consoleColors = state ;
9191 }
9292
@@ -108,7 +108,7 @@ class PuddySqlInstance extends PuddySqlEngine {
108108 */
109109 #debugSql( value ) {
110110 if ( typeof value !== 'string' || value . trim ( ) === '' )
111- throw new Error ( 'value must be a non-empty string' ) ;
111+ throw new TypeError ( 'value must be a non-empty string' ) ;
112112
113113 const useColor = this . #consoleColors !== false ;
114114
@@ -362,9 +362,10 @@ class PuddySqlInstance extends PuddySqlEngine {
362362 */
363363 #debugConsoleText( id , debugName = '' , status = '' ) {
364364 if ( typeof id !== 'string' && typeof id !== 'number' )
365- throw new Error ( 'id must be a string or number' ) ;
366- if ( typeof debugName !== 'string' ) throw new Error ( 'debugName must be a string if provided' ) ;
367- if ( typeof status !== 'string' ) throw new Error ( 'status must be a string if provided' ) ;
365+ throw new TypeError ( 'id must be a string or number' ) ;
366+ if ( typeof debugName !== 'string' )
367+ throw new TypeError ( 'debugName must be a string if provided' ) ;
368+ if ( typeof status !== 'string' ) throw new TypeError ( 'status must be a string if provided' ) ;
368369 const useColor = this . #consoleColors !== false ;
369370
370371 const reset = useColor ? '\x1b[0m' : '' ;
@@ -402,7 +403,7 @@ class PuddySqlInstance extends PuddySqlEngine {
402403 * @param {boolean } isDebug - If true, debug mode is enabled; otherwise, it's disabled.
403404 */
404405 setIsDebug ( isDebug ) {
405- if ( typeof isDebug !== 'boolean' ) throw new Error ( 'isDebug must be a boolean' ) ;
406+ if ( typeof isDebug !== 'boolean' ) throw new TypeError ( 'isDebug must be a boolean' ) ;
406407 this . #debug = isDebug ;
407408 }
408409
@@ -432,8 +433,8 @@ class PuddySqlInstance extends PuddySqlEngine {
432433 * @throws {Error } If the table has already been initialized.
433434 */
434435 async initTable ( settings = { } , tableData = [ ] ) {
435- if ( ! isJsonObject ( settings ) ) throw new Error ( 'settings must be a plain object' ) ;
436- if ( typeof settings . name !== 'string' ) throw new Error ( 'settings.name must be a string' ) ;
436+ if ( ! isJsonObject ( settings ) ) throw new TypeError ( 'settings must be a plain object' ) ;
437+ if ( typeof settings . name !== 'string' ) throw new TypeError ( 'settings.name must be a string' ) ;
437438 if ( ! this . #tables[ settings . name ] ) {
438439 const newTable = new PuddySqlQuery ( ) ;
439440 newTable . setDb ( settings , this ) ;
@@ -456,7 +457,7 @@ class PuddySqlInstance extends PuddySqlEngine {
456457 */
457458 getTable ( tableName ) {
458459 if ( typeof tableName !== 'string' || tableName . trim ( ) === '' )
459- throw new Error ( 'tableName must be a non-empty string' ) ;
460+ throw new TypeError ( 'tableName must be a non-empty string' ) ;
460461 const table = this . #tables[ tableName ] ;
461462 if ( ! table ) throw new Error ( `Table "${ tableName } " does not exist` ) ;
462463 return table ;
@@ -486,7 +487,7 @@ class PuddySqlInstance extends PuddySqlEngine {
486487 */
487488 removeTable ( tableName ) {
488489 if ( typeof tableName !== 'string' || tableName . trim ( ) === '' )
489- throw new Error ( 'tableName must be a non-empty string' ) ;
490+ throw new TypeError ( 'tableName must be a non-empty string' ) ;
490491 if ( ! this . #tables[ tableName ] )
491492 throw new Error ( `Table "${ tableName } " does not exist and cannot be removed` ) ;
492493 delete this . #tables[ tableName ] ;
0 commit comments