Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-23555

Soap exception coming from Moodle core always return "unknow error" when XML-RPC server and REST server return correct error message

    Details

    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE

      Description

      Soap exception coming from Moodle core always return "unknow error" when XML-RPC server and REST server return correct error message

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              ashleyholman Ashley Holman added a comment -

              I have attached a patch and a test script.

              Before applying the patch, the output of the test script is:

              SOAP Error: SoapFault exception: [Receiver] Unknown error in /git/nsmoodle20/testws.php:15

              After applying the patch, the output is:

              SOAP Error: SoapFault exception: [Receiver] Invalid external api parameter: users (Missing required key in single structure: firstname) in /git/nsmoodle20/testws.php:15

              There may also be other exception types that need to be registered - I will add them as I encounter them.

              Show
              ashleyholman Ashley Holman added a comment - I have attached a patch and a test script. Before applying the patch, the output of the test script is: SOAP Error: SoapFault exception: [Receiver] Unknown error in /git/nsmoodle20/testws.php:15 After applying the patch, the output is: SOAP Error: SoapFault exception: [Receiver] Invalid external api parameter: users (Missing required key in single structure: firstname) in /git/nsmoodle20/testws.php:15 There may also be other exception types that need to be registered - I will add them as I encounter them.
              Hide
              ashleyholman Ashley Holman added a comment -

              Found another one: "invalid_parameter_exception":

              However, this exception still does not provide enough information in its message:

              SOAP Error: SoapFault exception: [Receiver] Invalid parameter value detected, execution can not continue.

              The really useful information appears to be in the "debuginfo" property.

              invalid_parameter_exception Object
              (
              [errorcode] => invalidparameter
              [module] => debug
              [a] =>~
              [link] =>~
              [debuginfo] => Username already exists: wsuser1
              [message:protected] => Invalid parameter value detected, execution can not continue.

              So perhaps "debuginfo" needs to be part of the message returned to the caller?

              Show
              ashleyholman Ashley Holman added a comment - Found another one: "invalid_parameter_exception": However, this exception still does not provide enough information in its message: SOAP Error: SoapFault exception: [Receiver] Invalid parameter value detected, execution can not continue. The really useful information appears to be in the "debuginfo" property. invalid_parameter_exception Object ( [errorcode] => invalidparameter [module] => debug [a] =>~ [link] =>~ [debuginfo] => Username already exists: wsuser1 [message:protected] => Invalid parameter value detected, execution can not continue. So perhaps "debuginfo" needs to be part of the message returned to the caller?
              Hide
              jerome Jérôme Mouneyrac added a comment -

              Hi Ash,
              thanks for the patch I will add it.
              The thing is that debuginfo is not usefull in the webservice exception system, I could not find a easy way to get it and return it. but I'll have another look tomorrow.

              Show
              jerome Jérôme Mouneyrac added a comment - Hi Ash, thanks for the patch I will add it. The thing is that debuginfo is not usefull in the webservice exception system, I could not find a easy way to get it and return it. but I'll have another look tomorrow.
              Hide
              ashleyholman Ashley Holman added a comment -

              Hi Jerome,

              Here's the patch I am running which adds debuginfo to the end of the error response message.

              Also I've added the exception class name for unknown exception types.

              Show
              ashleyholman Ashley Holman added a comment - Hi Jerome, Here's the patch I am running which adds debuginfo to the end of the error response message. Also I've added the exception class name for unknown exception types.
              Hide
              jerome Jérôme Mouneyrac added a comment -

              Thanks Ash.
              Note that we cannot change the Zend library (except if it's to fix a Zend bug, after writing on issue on their tracker), so we will have to find another solution.
              But at least it' good to have a patch, other dev can use your from now, till we have something else

              Show
              jerome Jérôme Mouneyrac added a comment - Thanks Ash. Note that we cannot change the Zend library (except if it's to fix a Zend bug, after writing on issue on their tracker), so we will have to find another solution. But at least it' good to have a patch, other dev can use your from now, till we have something else
              Hide
              jerome Jérôme Mouneyrac added a comment -

              Hi Ash, I added some common exception handler, including the ones you mentioned.

              Show
              jerome Jérôme Mouneyrac added a comment - Hi Ash, I added some common exception handler, including the ones you mentioned.
              Hide
              jerome Jérôme Mouneyrac added a comment -

              I descreased the priority as most of the common exceptions will be well returned by SOAP now.
              Note to SOAP devs: if you develop only with SOAP, you can use Zend Ash's patch attached to this issue.

              Show
              jerome Jérôme Mouneyrac added a comment - I descreased the priority as most of the common exceptions will be well returned by SOAP now. Note to SOAP devs: if you develop only with SOAP, you can use Zend Ash's patch attached to this issue.
              Hide
              stronk7 Eloy Lafuente (stronk7) added a comment -

              NOTE: This issue was assigned to the STABLE backlog without complete triaging process. Marking it as triaged, but with this note for future reference.

              Show
              stronk7 Eloy Lafuente (stronk7) added a comment - NOTE: This issue was assigned to the STABLE backlog without complete triaging process. Marking it as triaged, but with this note for future reference.
              Hide
              jerome Jérôme Mouneyrac added a comment -

              Since 2.3 SOAP return nice error code like the other protocols. Closing this at fixed.

              Show
              jerome Jérôme Mouneyrac added a comment - Since 2.3 SOAP return nice error code like the other protocols. Closing this at fixed.

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: