Skip to content

Commit f7cab1a

Browse files
committed
update error handling
1 parent bb999aa commit f7cab1a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tawkto/tawkto.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,14 +436,14 @@ private static function validate_js_api_key( &$fields ) {
436436
return;
437437
}
438438

439-
try {
440-
if ( 40 !== strlen( $fields['js_api_key'] ) ) {
441-
throw new Exception( 'Invalid key. Please provide value with 40 characters' );
442-
}
439+
if ( 40 !== strlen( $fields['js_api_key'] ) ) {
440+
throw new Exception( 'Invalid API key.' );
441+
}
443442

443+
try {
444444
$fields['js_api_key'] = self::get_encrypted_data( $fields['js_api_key'] );
445445
} catch ( Exception $e ) {
446-
self::show_tawk_options_error( 'Javascript API Key: ' . $e->getMessage() );
446+
self::show_tawk_options_error( 'Error saving Javascript API Key.' );
447447

448448
unset( $fields['js_api_key'] );
449449
}

0 commit comments

Comments
 (0)