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
    • Rank:
      872

      Description

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

      1. mdl23555-debuginfo.patch
        0.7 kB
        Ashley Holman
      2. testws.php
        0.4 kB
        Ashley Holman
      3. ws_soap_parameter_exception.patch
        0.6 kB
        Ashley Holman

        Issue Links

          Activity

          Hide
          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
          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
          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
          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
          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
          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
          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
          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
          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
          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
          Jérôme Mouneyrac added a comment -

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

          Show
          Jérôme Mouneyrac added a comment - Hi Ash, I added some common exception handler, including the ones you mentioned.
          Hide
          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
          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
          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
          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
          Jérôme Mouneyrac added a comment -

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

          Show
          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: