mongodb - Mongoid Error Redirection -
i able redirect output raised error mongoid. have simple code in following layout:
begin [ruby code here query database] rescue [moped exception here] => e puts e.message end when error occurs, in following format:
moped::errors::connectionfailure: not connect primary node replica set <moped::cluster nodes=[<moped::node resolved_address=”ipaddress”>, <moped::node resolved_address=”ipaddress”>]> this error displayed several times before exception caught , displayed. i'm okay fact error occurs, hide error output above/not display it, , display exception. there way redirect error output raised connectionfailure error. or way configure mongoid such error messages not displayed (i'm running console)? way redirect errors helpful.
the mongoid documents shouldn't try rescuing connectionfailure: http://mongoid.org/en/moped/docs/driver.html#errors
besides this, don't care if occurs. code have tried redirecting user? using (rails, sinatra, etc.)?
for rails following:
if !request.env["http_referer"].blank? , request.env["http_referer"] != request.env["request_uri"] redirect_to :back else redirect_to root_path end this try send user previous path if possible (if stored), else bring them root.
Comments
Post a Comment