ROBOTC.net forums
http://robotc.net/forums/

Try... except.
http://robotc.net/forums/viewtopic.php?f=1&t=11514
Page 1 of 1

Author:  greenorange [ Sat Jun 13, 2015 2:34 am ]
Post subject:  Try... except.

Code:
Try:
    # Do something
Except:
   print "Error doing something"


This is how it works in python. Most other languages have some variation of this. What is this variation for RobotC, I've heard normal C doesn't have it but has this work around. It doesn't seem to work in RobotC.

Author:  mightor [ Sat Jun 13, 2015 4:44 am ]
Post subject:  Re: Try... except.

There is no support for user based exceptions, sorry.

= Xander

Author:  greenorange [ Sun Jun 14, 2015 12:46 am ]
Post subject:  Re: Try... except.

Thanks for the response.
Do you know what this error is?
Code:
PgmCnt: 0001A2
Type: 91


I'm guessing it's a maths error, I'm trying to triangulate an IR signal but the IR sensors don't seem very reliable. It may also be something to do with my internal positioning system.

UPDATE:

It's a divide by 0 error coursed by this line of code:
Code:
int sidea = (botdist*sin(angleB))/(sin(angleA));

I made an if statement, only do above if angleA != 0

Author:  mightor [ Sun Jun 14, 2015 1:20 am ]
Post subject:  Re: Try... except.

If you have the debugger attached, it should tell you the exception type.

= Xander

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/