1515
1616#include "command_response.h"
1717
18- #include <zend_exceptions.h>
19-
2018#include "ext/standard/php_var.h"
2119#include "include/glide/command_request.pb-c.h"
2220#include "include/glide/response.pb-c.h"
@@ -354,10 +352,10 @@ CommandResult* execute_command_with_route(const void* glide_client,
354352 if (!result ) {
355353 printf ("Error: Command execution returned NULL result\n" );
356354 } else if (result -> command_error ) {
357- zend_throw_exception (
358- get_valkey_glide_exception_ce (), result -> command_error -> command_error_message , 0 );
359- free_command_result ( result );
360- return NULL ;
355+ printf ( "Error: Command execution failed: %s\n" ,
356+ result -> command_error -> command_error_message
357+ ? result -> command_error -> command_error_message
358+ : "Unknown error" ) ;
361359 }
362360
363361 return result ;
@@ -386,12 +384,6 @@ CommandResult* execute_command(const void* glide_client,
386384 0 /* span pointer */
387385 );
388386
389- if (result -> command_error ) {
390- zend_throw_exception (
391- get_valkey_glide_exception_ce (), result -> command_error -> command_error_message , 0 );
392- free_command_result (result );
393- return NULL ;
394- }
395387 return result ;
396388}
397389
@@ -404,8 +396,10 @@ long handle_int_response(CommandResult* result, long* output_value) {
404396
405397 /* Check if there was an error */
406398 if (result -> command_error ) {
407- zend_throw_exception (
408- get_valkey_glide_exception_ce (), result -> command_error -> command_error_message , 0 );
399+ printf ("%s:%d - Error executing command: %s\n" ,
400+ __FILE__ ,
401+ __LINE__ ,
402+ result -> command_error -> command_error_message );
409403 free_command_result (result );
410404 return 0 ; /* False - failure */
411405 }
@@ -436,8 +430,10 @@ int handle_string_response(CommandResult* result, char** output, size_t* output_
436430
437431 /* Check if there was an error */
438432 if (result -> command_error ) {
439- zend_throw_exception (
440- get_valkey_glide_exception_ce (), result -> command_error -> command_error_message , 0 );
433+ printf ("%s:%d - Error executing command: %s\n" ,
434+ __FILE__ ,
435+ __LINE__ ,
436+ result -> command_error -> command_error_message );
441437 free_command_result (result );
442438 return -1 ;
443439 }
@@ -503,8 +499,10 @@ int handle_bool_response(CommandResult* result) {
503499
504500 /* Check if there was an error */
505501 if (result -> command_error ) {
506- zend_throw_exception (
507- get_valkey_glide_exception_ce (), result -> command_error -> command_error_message , 0 );
502+ printf ("%s:%d - Error executing command: %s\n" ,
503+ __FILE__ ,
504+ __LINE__ ,
505+ result -> command_error -> command_error_message );
508506 free_command_result (result );
509507 return -1 ;
510508 }
@@ -530,8 +528,10 @@ int handle_ok_response(CommandResult* result) {
530528
531529 /* Check if there was an error */
532530 if (result -> command_error ) {
533- zend_throw_exception (
534- get_valkey_glide_exception_ce (), result -> command_error -> command_error_message , 0 );
531+ printf ("%s:%d - Error executing command: %s\n" ,
532+ __FILE__ ,
533+ __LINE__ ,
534+ result -> command_error -> command_error_message );
535535 free_command_result (result );
536536 return -1 ;
537537 }
@@ -765,8 +765,10 @@ int handle_array_response(CommandResult* result, zval* output) {
765765
766766 /* Check if there was an error */
767767 if (result -> command_error ) {
768- zend_throw_exception (
769- get_valkey_glide_exception_ce (), result -> command_error -> command_error_message , 0 );
768+ printf ("%s:%d - Error executing command: %s\n" ,
769+ __FILE__ ,
770+ __LINE__ ,
771+ result -> command_error -> command_error_message );
770772 free_command_result (result );
771773 return -1 ;
772774 }
@@ -800,8 +802,10 @@ int handle_map_response(CommandResult* result, zval* output) {
800802
801803 /* Check if there was an error */
802804 if (result -> command_error ) {
803- zend_throw_exception (
804- get_valkey_glide_exception_ce (), result -> command_error -> command_error_message , 0 );
805+ printf ("%s:%d - Error executing command: %s\n" ,
806+ __FILE__ ,
807+ __LINE__ ,
808+ result -> command_error -> command_error_message );
805809 free_command_result (result );
806810 return -1 ;
807811 }
@@ -835,8 +839,10 @@ int handle_set_response(CommandResult* result, zval* output) {
835839
836840 /* Check if there was an error */
837841 if (result -> command_error ) {
838- zend_throw_exception (
839- get_valkey_glide_exception_ce (), result -> command_error -> command_error_message , 0 );
842+ printf ("%s:%d - Error executing command: %s\n" ,
843+ __FILE__ ,
844+ __LINE__ ,
845+ result -> command_error -> command_error_message );
840846 free_command_result (result );
841847 return -1 ;
842848 }
0 commit comments