Author Topic: Is Try-Except working?  (Read 815 times)

0 Members and 1 Guest are viewing this topic.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Is Try-Except working?
« on: December 29, 2012, 11:57:06 am »
http://delphibasics.co.uk/RTL.asp?Name=Try

Anyone knows if this still works in soldatpascal? I've used it A LOT in the past, but it doesn't appear to be working in these days.
www.soldatx.com.br - The brazilian Soldat community.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Is Try-Except working?
« Reply #1 on: December 29, 2012, 12:37:53 pm »
try..except/try..finally works, though you can't use "on" keyword, just pure except block

EDIT: you might have some problems, according to this report, otherwise it should be just fine
« Last Edit: December 29, 2012, 12:52:14 pm by FalconPL »
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline squiddy

  • Soldat Beta Team
  • Camper
  • ******
  • Posts: 333
  • Flagger assassin
    • SoldatX
Re: Is Try-Except working?
« Reply #2 on: December 29, 2012, 02:47:17 pm »
Well.. I think I found out why I was having troubles with this.

I generally use Try..Except to convert string -> integer. So, I'd do like:

Code: [Select]
try
    int := strtoint(getpiece(text,' ',0));
    except
    writeln('error!');
    exit;
    end;

BUT, apparently, shoozza must have modified how StrToInt() works, because when it doesn't return a proper integer value, it returns "255". So, there would never be an exception to occur. I wonder why he did that, though.

Anyway, thanks!
www.soldatx.com.br - The brazilian Soldat community.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Is Try-Except working?
« Reply #3 on: December 29, 2012, 03:20:07 pm »
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.