NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Better Error Trapping


Joined: 16 Jul 2005
Posts: 5
Reply with quote
Product: PHPed
Version: 3.3.3 (Build 3397)


I have written a script that uses a switch statement with 20+ options.
When I try to run this in PHPed, I get a Windows Script Error. I have removed different sections of the code in order to determine what was causing the problem. Here is what I have found.

If you do not have "case" in front of the case statement, PHPed crashes as explained above, with no error information to point you in the right direction.

Is it possible to trap this crash and display pertinent error information in the future?


--Code Snippet Crashes--
Code:
 

      case "ManPartNo"  :
              "Manufacturer_Part_Number":   $relay=trim($data["ISBN"]);         break;

      default    : $relay = $defaults[$fieldname];

    } // end switch

--End Code Snippet--


The correct code snippet
--Code Snippet Crashes--
Code:
 

      case "ManPartNo"  :
      case "Manufacturer_Part_Number":   $relay=trim($data["ISBN"]);         break;

      default    : $relay = $defaults[$fieldname];

    } // end switch

--End Code Snippet--
View user's profileFind all posts by phormanSend private message


Joined: 09 Dec 2003
Posts: 92
Reply with quote
I'm not a Nusphere guy Smile, but maybe you can explain a little more when/how this crash occurs? When running the script with the debugger enabled? When opening the file in PhpED?
View user's profileFind all posts by mpSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Quote:
If you do not have "case" in front of the case statement, PHPed crashes as explained above, with no error information to point you in the right direction.

Perhaps, I did not get your point, but as far as I see phped 3.3.3(3397) gives all necessary info. See the screenshot below.

View user's profileFind all posts by dmitriSend private messageVisit poster's website
Re: Better Error Trapping


Joined: 04 May 2005
Posts: 14
Reply with quote
phorman wrote:
If you do not have "case" in front of the case statement,

... you have a syntax error.
View user's profileFind all posts by rithbanSend private message
Better Error Trapping
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic