Page 1 of 1

Uncaught Exceptions - custom pre-set messages?

Posted: Mon Feb 23, 2009 7:21 pm
by MichaelGallagher
Hi Chris & co,

I was just thinking about the uncaught exceptions i get all the time, and i was thinking it would be a great idea to have some sort of wizard or package of customizable pre-set error messages available in version 4.

I keep gettin a particular error, which I have search high and low for on the forums and google, and although some people have experienced it also, I cannot find a reasonable solution or explanation.

Code: Select all

Fatal error: Uncaught exception 'Swift_BadResponseException' with message 'Expected response code(s) [250] but got response []' in /var/www/include/Swift.php:250 Stack trace:
#0 /var/www/include/Swift.php(310): Swift->assertCorrectResponse(Object(Swift_Events_ResponseEvent), 250)
#1 /var/www/include/Swift.php(262): Swift->command('HELO [192.168.1...', 250)
#2 /var/www/include/Swift.php(220): Swift->handshake(Object(Swift_Events_ResponseEvent))
#3 /var/www/include/Swift.php(101): Swift->connect()
#4 /var/www/html/folder/program/email.php(634): Swift->__construct(Object(Swift_Connection_SMTP))
#5 {main} thrown in /var/www/include/Swift.php on line 250
I am assuming this is a timeout issue on the server, as it is intermittent, but becoming more frequent.
It occurs on emails with attachments and without

Apart from also being unable to send to BCC recipients, its a great piece of software, which I would like to purchase.

I am using version 3.3.3.

I appologise if this has been covered previously. Please direct me to the source if it has.

Cheers,

Mick

Re: Uncaught Exceptions - custom pre-set messages?

Posted: Mon Feb 23, 2009 7:35 pm
by Chris Corbyn
I'll write a whole bunch of documentation on the exceptions and what they all mean (and what action you should take). In version 4 there should be less Exceptions that bubble up to the top of the stack like this (it tries to be more robust). I think we'll keep going down that road and letting Swift take "sensible" actions on such errors (such as just returning 0).

Let's see if v4 behaves any better for you ;) I'm working flat out trying to finish the website off so we can actually launch this thing! :P

Re: Uncaught Exceptions - custom pre-set messages?

Posted: Mon Feb 23, 2009 7:50 pm
by MichaelGallagher
I think we'll keep going down that road and letting Swift take "sensible" actions on such errors (such as just returning 0).
That is a great idea; much easier to handle the exceptions and generate the necessary response to the client.
Let's see if v4 behaves any better for you ;) I'm working flat out trying to finish the website off so we can actually launch this thing! :P
Mate, I can only imagine the late nights you must be having.

I am using the 3.3.3 version on a live project where 80 people are using it daily, so unfortunately my own time is taken up with development and maintenance of our CMS, otherwise I would love to try out the new Beta.

Also, becuase we are using it on a commercial application (internal only), my bosses are very insistant on sending you some money, either as a donation or an outright purchase. We have to wait until the final stages of the application however, before sending money, incase we (they) choose to use a different technology. Either way, a donation of some sort shall be sent..

What is your stance on selling the package? With / without support?

Cheers,

Mick

Re: Uncaught Exceptions - custom pre-set messages?

Posted: Mon Feb 23, 2009 8:16 pm
by josh
You should wrap the code in a try block and catch the exception, and then do whatever you want to do in the event of failure. Of course the more direct fix is to get the thing working, but exceptions can occur and you should catch them

Re: Uncaught Exceptions - custom pre-set messages?

Posted: Mon Feb 23, 2009 10:27 pm
by MichaelGallagher
I do catch exceptions, but this one has always had me wondering what it means, since the response is []... nothing to really identify it to me, and its the one i frequently encounter.

My original post was to mention that, along with documentation, there may be room for some already constructed try blocks with exception handling built in, ready to customize. I suppose coming from a programmer this request could be construed as me being lazy... :mrgreen:

mick