Re: [Mojolicious] Re: Handle database errors with Mojo::Pg

2014-12-18 Thread Andrey Khozov
On Wed, Dec 17, 2014 at 5:47 PM, Jan Henning Thorsen  wrote:
>
> You should handle the error somehow. If you don't want to, then the best
> strategy is simply to "die $err if $err;". That way, the error will
> propagate correctly and result in a 500 page.


​Of course, I can wrap all non-blocking requests through mojo::pg in eval
and handle errors, but it is not common to do in asynchronous programming.
Callback function should always be called at any non-blocking method. And
I'm concerned that non-blocking methods can throw exceptions.​


-- 
Andrey Khozov

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Handle database errors with Mojo::Pg

2014-12-17 Thread sri

>
> I think sri meant "Mojo::Pg does not actually emit an error event".
>

No, i did not.

--
sebastian 

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Handle database errors with Mojo::Pg

2014-12-17 Thread Jan Henning Thorsen
I think sri meant "Mojo::Pg does not actually emit an error event".

Anyhow...

You should handle the error somehow. If you don't want to, then the best 
strategy is simply to "die $err if $err;". That way, the error will 
propagate correctly and result in a 500 page.

By handling, I mean checking if you can continue in your app, doing 
something else.


On Sunday, December 14, 2014 2:36:21 PM UTC+1, sri wrote:
>
> I was hoping that I could handle this error through the error event (as in 
>> Mojo::UserAgent when the error is not bound to a tx), but it seems not 
>> working:
>>
>
> Mojo::UserAgent does not actually emit an error event.
>
> --
> sebastian 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Handle database errors with Mojo::Pg

2014-12-14 Thread sri

>
> I was hoping that I could handle this error through the error event (as in 
> Mojo::UserAgent when the error is not bound to a tx), but it seems not 
> working:
>

Mojo::UserAgent does not actually emit an error event.

--
sebastian 

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.