Seems like every exception-throwing language has a base error or exception class that is too generic to be useful. I know Python has class Exception which is intended mostly to be subclassed for specific applications. Even then, though, you can pass a custom message to the constructor and the traceback will point you to the specific line that raised it. Does Perl have a try/catch syntax for exceptions? Error handling is one of the most frustrating things about VB after working with something as fabulous as Python's try/except/finally/else blocks.

: Error handling is one of the most frustrating things about VB [blue] You wouldn't say that after trying PowerBuilder 5.0 Error method. That's real piece of crap! It simply does not work at all![/blue]

: Seems like every exception-throwing language has a base error or : exception class that is too generic to be useful. I know Python has : class Exception which is intended mostly to be subclassed for : specific applications. Even then, though, you can pass a custom : message to the constructor and the traceback will point you to the : specific line that raised it. I think the JAVA one would return the line that raised the exception. I only wished it had been posted...just imagine "I've got an General Error on line 25 of my code. Help!" with no code. I wouldn't know whether to laugh or cry...

: Does Perl have a try/catch syntax for exceptions? If Perl has a weak spot I can pick at, this might be it. There is a way to throw an exception (using the die keyword), and this propogates up to the next eval { ... } block and causes that to fail. You can check the return value of the eval block to see if an exception was caught, and if it was you can handle it as you wish. This works for both user thrown exceptions and ones that Perl throws. If you don't have a handler, it propogates to the top and Perl spits out the error and terminates.

The main weakness is that there isn't any kind of exception object or any standardised way of saying what went wrong. You are dependent mainly on text based messages, which you set and then have to parse later - a problem. You might well be able to define your own exception object, mind...and there may be modules that handle exception stuff better that you can use.

On the other hand, Perl does allow you to put short circuit OR operators to good use for simple error handling:-

open my $fh, "somefile.txt" || die "Couldn't open file - $!";

Good for simple stuff - probably for small scripting tasks, which is where Perl was heavily used in the early days of it's existence.

I suspect that things will be much improved on this front in Perl6. I certainly hope they will be. :-)

: Error handling is one of the most frustrating things : about VB after working with something as fabulous as Python's : try/except/finally/else blocks.I never liked VBs error handling mechanisms full stop. Even before I saw what else was "out there".

: : Error handling is one of the most frustrating things about VB : [blue] You wouldn't say that after trying PowerBuilder 5.0 Error method. That's real piece of crap! It simply does not work at all![/blue]

PowerBuilder - is that a Borland thing? Tied to any particular language?

[b][red]This message was edited by lionb at 2003-11-17 13:21:29[/red][/b][hr]: : : Error handling is one of the most frustrating things about VB : : [blue] You wouldn't say that after trying PowerBuilder 5.0 Error method. That's real piece of crap! It simply does not work at all![/blue] : : PowerBuilder - is that a Borland thing? Tied to any particular language?: : Jonathan: : ###: for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&: (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;: /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");: : Ooops! Did I send empty message?

: : : : Error handling is one of the most frustrating things about VB : : : [blue] You wouldn't say that after trying PowerBuilder 5.0 Error method. That's real piece of crap! It simply does not work at all![/blue] : : : : PowerBuilder - is that a Borland thing? Tied to any particular language?: : : : Jonathan: : You mean Builder Studio? No. PowerBuilder is a OO language. It was created by PeopleSoft company which was aquired by Sybase.

: : : : : Error handling is one of the most frustrating things about VB : : : : [blue] You wouldn't say that after trying PowerBuilder 5.0 Error method. That's real piece of crap! It simply does not work at all![/blue] : : : : : : PowerBuilder - is that a Borland thing? Tied to any particular language?: : : : : : Jonathan: : : : You mean Builder Studio? No. PowerBuilder is a OO language. It was created by PeopleSoft company which was aquired by Sybase.

What little I've heard of PowerBuilder is generally positive. Interesting to hear a specific complaint.

Oracle's PL/SQL language recently got some fairly good exception handling capabilities. In fact, I might consider PL/SQL one of my favorite languages to work with.

: : Does Perl have a try/catch syntax for exceptions? : If Perl has a weak spot I can pick at, this might be it. There is a way to throw an exception (using the die keyword), and this propogates up to the next eval { ... } block and causes that to fail. You can check the return value of the eval block to see if an exception was caught, and if it was you can handle it as you wish. This works for both user thrown exceptions and ones that Perl throws. If you don't have a handler, it propogates to the top and Perl spits out the error and terminates.: : The main weakness is that there isn't any kind of exception object or any standardised way of saying what went wrong. You are dependent mainly on text based messages, which you set and then have to parse later - a problem. You might well be able to define your own exception object, mind...and there may be modules that handle exception stuff better that you can use.: : On the other hand, Perl does allow you to put short circuit OR operators to good use for simple error handling:-: : open my $fh, "somefile.txt" || die "Couldn't open file - $!";: : Good for simple stuff - probably for small scripting tasks, which is where Perl was heavily used in the early days of it's existence.: : I suspect that things will be much improved on this front in Perl6. I certainly hope they will be. :-)

Python has great exception handling. You can define your own exceptions just by creating an empty subclass of Exception.

[b][red]This message was edited by lionb at 2003-11-18 7:13:20[/red][/b][hr]: : : : : : Error handling is one of the most frustrating things about VB : : : : : [blue] You wouldn't say that after trying PowerBuilder 5.0 Error method. That's real piece of crap! It simply does not work at all![/blue] : : : : : : : : PowerBuilder - is that a Borland thing? Tied to any particular language?: : : : : : : : Jonathan: : : : : : You mean Builder Studio? No. PowerBuilder is a OO language. It was created by PeopleSoft company which was aquired by Sybase.: : What little I've heard of PowerBuilder is generally positive. Interesting to hear a specific complaint.: [blue] I used to work with 2 versions of PB 5.0 and 7. IMO, last one was the worse. PB 5.0 generally was fine and in some cases even much better than VB. The best example Window/Data Control. No one of Microsoft Grid Controls is not even close to the same PB control. It's very friendly and works perfectly. At the same time, some PB stuff, like Error object is very week or does not work properly. Sometimes using API functions failed. Or working with Menu ... That was a real head ache. Besides, even though PB is OO language, there was not way to build something like UserControl or ActiveX in PB 5.0. Working with "foreign" objects like Adobe PDF Reader was a real paint of the ass. PB 7 was very unstable. I've never seen so many Dr.Watson Error messages during the design time working with another languages. Sybase also released piece of crap named Jaguar (for me it looked like bad copy of another piece of crap MTS) together with PB 6. Since 20001 (PB 7 was released) Sybase released PB 8 and very soon after that PB 9. Even Microsoft do not released new versions of its products that quick ... In other words, nothing is perfect in this world[/blue]

: : Oracle's PL/SQL language recently got some fairly good exception handling capabilities. In fact, I might consider PL/SQL one of my favorite languages to work with.: : : [size=5][italic][blue][RED]i[/RED]nfidel[/blue][/italic][/size]: : I thought it's a Python. Or Python is just a pet language?

Python is my favorite language overall. I actually have to use PL/SQL at work and at first I didn't care for it but I've really learned to like what it has to offer - with the caveat that it only runs in Oracle databases. Since we're stuck using an Oracle database for the project, I very much prefer coding in PL/SQL than in VB. One part of the project prints documents. It used to be a horrible nightmare of Crystal Reports and VB hacks. Now, 90% of the code is in the database and VB is only used to transform the XML returned by the database into XSL-FO and then call FOP and GhostScript. I've since learned how to also do XSLT in the database, so in theory the database could contain 99% of the document generating code and VB would be solely responsible for driving the process. Even that could be replaced by some clever .BAT scripting. Ooh, or Python. Hmmmm.....

You might want to try a fairly recent version. 5.0 is at least 6 or 7 years old. The current versions (8 and 9) offer structured exception handling...

: : Error handling is one of the most frustrating things about VB : [blue] You wouldn't say that after trying PowerBuilder 5.0 Error method. That's real piece of crap! It simply does not work at all![/blue] : :