Skip to content
This repository
Browse code

Fixed one more time error messages to reflect the correct use of Join…

…Point
  • Loading branch information...
commit 194ddd986ce1089b2a5d77cec595e2264871eff1 1 parent bcca60c
Gérald Croës authored

Showing 2 changed files with 11 additions and 10 deletions. Show diff stats Hide diff stats

  1. 1  CHANGELOG
  2. 20  aop.c
1  CHANGELOG
... ...
@@ -1,6 +1,7 @@
1 1
 0.2
2 2
 AopTriggeredJoinPoint was renamed AopJoinPoint
3 3
 AopJoinPoint->getTriggering* was renamed AopJoinPoint->get*
  4
+Updated error messages to be more explicit
4 5
 lots of bug fixes
5 6
 performances improvements
6 7
 
20  aop.c
@@ -636,7 +636,7 @@ PHP_MINIT_FUNCTION(aop)
636 636
 PHP_METHOD(AopJoinpoint, getPropertyName){
637 637
     AopJoinpoint_object *obj = (AopJoinpoint_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
638 638
     if (!(obj->current_pointcut->kind_of_advice & AOP_KIND_PROPERTY)) {
639  
-        zend_error(E_ERROR, "getPropertyName is only available when the JoinPoint is triggered from a property operation"); 
  639
+        zend_error(E_ERROR, "getPropertyName is only available when the JoinPoint is a property operation (read or write)"); 
640 640
     }
641 641
     if (obj->member!=NULL) {
642 642
         RETURN_ZVAL(obj->member, 1, 0);
@@ -647,7 +647,7 @@ PHP_METHOD(AopJoinpoint, getPropertyName){
647 647
 PHP_METHOD(AopJoinpoint, getArguments){
648 648
     AopJoinpoint_object *obj = (AopJoinpoint_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
649 649
     if (obj->current_pointcut->kind_of_advice & AOP_KIND_PROPERTY) {
650  
-        zend_error(E_ERROR, "getArguments is only available when the JoinPoint is triggered from a function or method call"); 
  650
+        zend_error(E_ERROR, "getArguments is only available when the JoinPoint is a function or method call"); 
651 651
     }
652 652
     if (obj->args != NULL) {
653 653
         RETURN_ZVAL(obj->args, 1, 0);
@@ -659,7 +659,7 @@ PHP_METHOD(AopJoinpoint, setArguments){
659 659
     AopJoinpoint_object *obj = (AopJoinpoint_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
660 660
     zval *params;
661 661
     if (obj->current_pointcut->kind_of_advice & AOP_KIND_PROPERTY) {
662  
-        zend_error(E_ERROR, "setArguments is only available when the JoinPoint is triggered from a function or method call"); 
  662
+        zend_error(E_ERROR, "setArguments is only available when the JoinPoint is a function or ia method call"); 
663 663
     }
664 664
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &params) == FAILURE) {
665 665
         zend_error(E_ERROR, "setArguments expects an array as its first argument");
@@ -683,7 +683,7 @@ PHP_METHOD(AopJoinpoint, getPointcut){
683 683
 PHP_METHOD(AopJoinpoint, getReturnedValue){
684 684
     AopJoinpoint_object *obj = (AopJoinpoint_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
685 685
     if (obj->current_pointcut->kind_of_advice & AOP_KIND_PROPERTY) {
686  
-        zend_error(E_ERROR, "getReturnedValue is not available when the JoinPoint is triggered from a property operation"); 
  686
+        zend_error(E_ERROR, "getReturnedValue is not available when the JoinPoint is a property operation (read or write)"); 
687 687
     }
688 688
     if (obj->current_pointcut->kind_of_advice & AOP_KIND_BEFORE) {
689 689
         zend_error(E_ERROR, "getReturnedValue is not available when the advice was added with aop_add_before");
@@ -698,7 +698,7 @@ PHP_METHOD(AopJoinpoint, getReturnedValue){
698 698
 PHP_METHOD(AopJoinpoint, getAssignedValue){
699 699
     AopJoinpoint_object *obj = (AopJoinpoint_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
700 700
     if (!(obj->current_pointcut->kind_of_advice & AOP_KIND_WRITE)) {
701  
-        zend_error(E_ERROR, "getAssignedValue is only available when the JoinPoint is triggered from a property write operation"); 
  701
+        zend_error(E_ERROR, "getAssignedValue is only available when the JoinPoint is a property write operation"); 
702 702
     }
703 703
     if (obj->value!=NULL) {
704 704
         zval_ptr_dtor (return_value_ptr);
@@ -713,7 +713,7 @@ PHP_METHOD(AopJoinpoint, setAssignedValue){
713 713
     zval *ret;
714 714
     AopJoinpoint_object *obj = (AopJoinpoint_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
715 715
     if (obj->current_pointcut->kind_of_advice & AOP_KIND_READ) {
716  
-        zend_error(E_ERROR, "setAssignedValue is not available when the JoinPoint is triggered from a property read operation"); 
  716
+        zend_error(E_ERROR, "setAssignedValue is not available when the JoinPoint is a property read operation"); 
717 717
     }
718 718
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &ret) == FAILURE) {
719 719
                 zend_error(E_ERROR, "Error");
@@ -728,7 +728,7 @@ PHP_METHOD(AopJoinpoint, setReturnedValue){
728 728
     zval *ret;
729 729
     AopJoinpoint_object *obj = (AopJoinpoint_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
730 730
     if (obj->current_pointcut->kind_of_advice & AOP_KIND_WRITE) {
731  
-        zend_error(E_ERROR, "setReturnedValue is not available when the JoinPoint is triggered from a property write operation"); 
  731
+        zend_error(E_ERROR, "setReturnedValue is not available when the JoinPoint is a property write operation"); 
732 732
     }
733 733
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &ret) == FAILURE) {
734 734
                 zend_error(E_ERROR, "Error");
@@ -777,7 +777,7 @@ PHP_METHOD(AopJoinpoint, getFunctionName){
777 777
     zend_execute_data *data = obj->ex;
778 778
     zend_function *curr_func;
779 779
     if (obj->current_pointcut->kind_of_advice & AOP_KIND_PROPERTY || obj->current_pointcut->kind_of_advice & AOP_KIND_METHOD) {
780  
-        zend_error(E_ERROR, "getMethodName is only available when the JoinPoint is triggered from a function call"); 
  780
+        zend_error(E_ERROR, "getMethodName is only available when the JoinPoint is a function call"); 
781 781
     }
782 782
     if (data == NULL) {
783 783
         RETURN_NULL();
@@ -792,7 +792,7 @@ PHP_METHOD(AopJoinpoint, getMethodName){
792 792
     zend_execute_data *data = obj->ex;
793 793
     zend_function *curr_func;
794 794
     if (obj->current_pointcut->kind_of_advice & AOP_KIND_PROPERTY || obj->current_pointcut->kind_of_advice & AOP_KIND_FUNCTION) {
795  
-        zend_error(E_ERROR, "getMethodName is only available when the JoinPoint is triggered from a method call"); 
  795
+        zend_error(E_ERROR, "getMethodName is only available when the JoinPoint is a method call"); 
796 796
     }
797 797
     if (data == NULL) {
798 798
         RETURN_NULL();
@@ -804,7 +804,7 @@ PHP_METHOD(AopJoinpoint, getMethodName){
804 804
 PHP_METHOD(AopJoinpoint, process){
805 805
     AopJoinpoint_object *obj = (AopJoinpoint_object *)zend_object_store_get_object(getThis() TSRMLS_CC);
806 806
     if (!(obj->current_pointcut->kind_of_advice & AOP_KIND_AROUND)) {
807  
-        zend_error(E_ERROR, "process is only available when the JoinPoint is triggered for an advice added with aop_add_around"); 
  807
+        zend_error(E_ERROR, "process is only available when the advice was added with aop_add_around"); 
808 808
     }
809 809
     if (obj->current_pointcut->kind_of_advice & AOP_KIND_PROPERTY) {
810 810
         if (obj->current_pointcut->kind_of_advice & AOP_KIND_WRITE) {

0 notes on commit 194ddd9

Please sign in to comment.
Something went wrong with that request. Please try again.