Non-representative line
-
This app I'm doing things for is otherwise excellently constructed, but then I found this:
if(intRemaining < 750) {
throw new Error("Remaining < 750");
}No comments, no nothing.
THE HELL.
-
You can't possibly be less, than 750. That is an error, sir.
-
Hey, at least the error message is accurate.
-
-
@dhromed said:
intRemaining
Yup, there's your problem: it should be iRemaining. Why can't they even get their wrong Hungarian notation right?
-
@bstorer said:
@dhromed said:
intRemaining
Yup, there's your problem: it should be iRemaining. Why can't they even get their wrong Hungarian notation right?iRemaining: what's left of an Apple product after you take away all the shiny bits. Definitely less than 750.
-
Am I the only one who noticed a class extending Exception is called Error?
-
@Schlagwerk said:
Yeah, so?Am I the only one who noticed a class extending Exception is called Error?
-
Oh, I thought it was C#. I avoid Java like the plague.
-
@Schlagwerk said:
It very well could be C#. Or C++, for that matter. Or Javascript, which also has an Error object (actually, it's probably Javascript, because dhromed was talking about his gay love for jQuery the other day).Oh, I thought it was C#. I avoid Java like the plague.
-
It is...
(drumroll)
ASP Classic / JScript!
I really like the language, though.
-
@dhromed said:
ASP Classic
*dry heave*I used that in uni, because I was clueless, and then happened to switch to PHP which turned out to be about 10 times better. And this is PHP we're talking about.
-
@bstorer said:
Or Javascript, which also has an Error object
Javascript has exceptions?No, seriously. You just blew my fucking mind.
-
We have our own library.
It's a very awesome library that abstracts away all that response and request and ADODB recordset object shit. It also adds a lot of productive methods to standard objects because JS is a rather skeletal language. Things like rounding numbers and formatting dates, trimming strings and removing html, superior querystring and POST data interaction, etc, etc.
I kind of heart it.
-
@Weng said:
Javascript has exceptions?
No, seriously. You just blew my fucking mind.
What do you mean, exactly? It has try/catch/finally and an error class, but the exception model is very basic.
-
@dhromed said:
What do you mean, exactly? It has try/catch/finally and an error class, but the exception model is very basic.
The problem seems to be the (rather appalling) lack of a standard stack-trace property on Error instances, meaning you're stuck with having to implement your own or getting someone who's done it already.I prefer not to use custom exceptions, though, and stick to the good old "return false".
-
@Weng said:
We're talking about Javascript from planet Earth. Not the mysterious planet Wongo you apparently code on.@bstorer said:
Or Javascript, which also has an Error object
Javascript has exceptions?No, seriously. You just blew my fucking mind.
-
BTW if you ever want to have "fun", set IE to the mode where it alerts you on every unhandled Javascript exception, then visit your favorite sites. See how buggy the web is! It's staggering how many Javascript "programmers" never bother to check their code for unhandled exceptions.