error handling issue

3 views
Skip to first unread message

Roberto Saccon

unread,
Mar 5, 2010, 8:20:00 PM3/5/10
to nitro-devel
I updated an app of mine which uses nitro and run into an issue with
error handling:


a typical 404 error (not finding the template) results in an error
like this

Error: require error: couldn't find "..."


but in dispatcher.js, there a in my opinion wrong RegExp:


if (/^require error/.test(e.toString())) // FIXME: a better test
needed here!
return {status: 404, headers: {}, body: ["Action not found",
e.toString()]};
else
throw e;

I changed the RegExp in my app to: (/^Error: require
error/.test(e.toString())), and it seems to work propperly.

Roberto Saccon

unread,
Mar 6, 2010, 12:33:06 AM3/6/10
to nitro-devel
And one more question:

is there currently a way to differentiate between errorpages based on
status codes ? A error.html seems to catch all.

so I guess the way to go is to use a custom error wrapper instead of
nitro/Error

--
Roberto

George Moschovitis

unread,
Mar 6, 2010, 2:18:05 AM3/6/10
to nitro...@googlegroups.com
I changed the RegExp in my app to: (/^Error: require
error/.test(e.toString())), and it seems to work propperly.

can you send a pull request?

thanks,
-g.
 

--
You received this message because you are subscribed to the Google Groups "nitro-devel" group.
To post to this group, send email to nitro...@googlegroups.com.
To unsubscribe from this group, send email to nitro-devel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nitro-devel?hl=en.




--
http://www.gmosx.com/blog

George Moschovitis

unread,
Mar 6, 2010, 2:19:07 AM3/6/10
to nitro...@googlegroups.com
one error handler works fine for me. however if you create an improved handler please let me know and I 'll consider it for inclusion as the default error handler.

thanks,
-g.

--
You received this message because you are subscribed to the Google Groups "nitro-devel" group.
To post to this group, send email to nitro...@googlegroups.com.
To unsubscribe from this group, send email to nitro-devel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nitro-devel?hl=en.

Roberto Saccon

unread,
Mar 6, 2010, 7:51:57 AM3/6/10
to nitro-devel
sent pull request

On Mar 6, 4:18 am, George Moschovitis <george-moschovi...@gmosx.com>
wrote:


> > I changed the RegExp in my app to: (/^Error: require
> > error/.test(e.toString())), and it seems to work propperly.
>
> can you send a pull request?
>
> thanks,
> -g.
>
>
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nitro-devel" group.
> > To post to this group, send email to nitro...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > nitro-devel...@googlegroups.com<nitro-devel%2Bunsubscribe@googlegr oups.com>

Roberto Saccon

unread,
Mar 16, 2010, 5:48:59 PM3/16/10
to nitro-devel
I modified the errorhandler, to select different error templates for
4XX / 5XX errors. In case you like the approach, I also made a pull
request.

On Mar 6, 4:19 am, George Moschovitis <george-moschovi...@gmosx.com>
wrote:

> > nitro-devel...@googlegroups.com<nitro-devel%2Bunsubscribe@googlegr oups.com>

George Moschovitis

unread,
Mar 17, 2010, 2:25:10 AM3/17/10
to nitro...@googlegroups.com
OK, will have a look later today thanks.

To unsubscribe from this group, send email to nitro-devel...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/nitro-devel?hl=en.




--
http://www.gmosx.com/blog

George Moschovitis

unread,
Mar 20, 2010, 5:08:05 AM3/20/10
to nitro-devel
OK, I added the change...

Perhaps we need better default paths, perhaps:

4xx.html
5xx.html

will have to think about that...

thanks,
-g.

Reply all
Reply to author
Forward
0 new messages