I''m experimenting to understand how Rails deals with various errors. When there''s a Ruby or Rails syntax error, we get the stack trace. However, when there''s an SQL error, the entire application appears to be silent about it. In dev mode, and made sure logging was explicitly set to debug. If I do somthing like change a field name in a table to ensure a failure, the development.log says nothing about it. I know the query failed, and the partial which would have displayed data from the query doesn''t get drawn, so Rails has to be detecting failures somewhere -- why no messages?? -- gw (www.railsdev.ws) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hmm, are you running this inside of a begin block or rescuing it at some point? When I encounter sql errors, I get a full stack track along with the error returned from Mysql. Is this on create / update / insert or on selecting records? -Bill Greg Willits wrote:> I''m experimenting to understand how Rails deals with various errors. > > When there''s a Ruby or Rails syntax error, we get the stack trace. > > However, when there''s an SQL error, the entire application appears to > be silent about it. > > In dev mode, and made sure logging was explicitly set to debug. > > If I do somthing like change a field name in a table to ensure a > failure, the development.log says nothing about it. I know the query > failed, and the partial which would have displayed data from the query > doesn''t get drawn, so Rails has to be detecting failures somewhere -- > why no messages?? > > -- gw (www.railsdev.ws) > > > > >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Having a begin/rescue structure or not doesn''t change the behavior. I have coordinated the error to happen with a find and with an update_attributes (by changing a field name just before trigging a specific action). If it is normal to get some messaging, then it has to be some detail in my environment. I''ll dig deeper. -- gw On Nov 15, 2007, at 7:53 PM, William Pratt wrote:> Hmm, are you running this inside of a begin block or rescuing it at > some point? When I encounter sql errors, I get a full stack track > along with the error returned from Mysql. Is this on create / > update / insert or on selecting records? > > -Bill > > Greg Willits wrote: >> I''m experimenting to understand how Rails deals with various errors. >> >> When there''s a Ruby or Rails syntax error, we get the stack trace. >> >> However, when there''s an SQL error, the entire application appears >> to be silent about it. >> >> In dev mode, and made sure logging was explicitly set to debug. >> >> If I do somthing like change a field name in a table to ensure a >> failure, the development.log says nothing about it. I know the >> query failed, and the partial which would have displayed data from >> the query doesn''t get drawn, so Rails has to be detecting failures >> somewhere -- why no messages?? >> >> -- gw (www.railsdev.ws) >>--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 15, 2007 4:38 PM, Greg Willits <lists-0Bv1hcaDFPRk211Z5VL+QA@public.gmane.org> wrote:> However, when there''s an SQL error, the entire application appears to be > silent about it. > In dev mode, and made sure logging was explicitly set to debug. > > If I do somthing like change a field name in a table to ensure a failure, > the development.log says nothing about it. I know the query failed, and > the partial which would have displayed data from the query doesn''t get > drawn, so Rails has to be detecting failures somewhere -- why no messages? >Are you writing explicit queries or using a find_by_xxx where xxx is a field that does not exist in the database? From your description, I suspect the SQL isn''t erroring - it just isn''t returning the results you expect. If you copy the SQL out of the development log into mysql (or pgsql or whatever your database querying tool is), do you get an error? or do you just get 0 rows returned? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
He was purposefully causing a sql error by changing the schema. He would remove a column then query on it. It has to be something with his environment or he is rescuing it somewhere. -Bill On Nov 16, 2007, at 11:10 PM, Cynthia Kiser wrote:> On Nov 15, 2007 4:38 PM, Greg Willits <lists-0Bv1hcaDFPRk211Z5VL+QA@public.gmane.org> wrote: > However, when there''s an SQL error, the entire application appears > to be silent about it. > > In dev mode, and made sure logging was explicitly set to debug. > > If I do somthing like change a field name in a table to ensure a > failure, the development.log says nothing about it. I know the query > failed, and the partial which would have displayed data from the > query doesn''t get drawn, so Rails has to be detecting failures > somewhere -- why no messages? > > Are you writing explicit queries or using a find_by_xxx where xxx is > a field that does not exist in the database? From your description, > I suspect the SQL isn''t erroring - it just isn''t returning the > results you expect. If you copy the SQL out of the development log > into mysql (or pgsql or whatever your database querying tool is), do > you get an error? or do you just get 0 rows returned? > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 16, 2007, at 11:10 PM, Cynthia Kiser wrote:> On Nov 15, 2007 4:38 PM, Greg Willits <lists-0Bv1hcaDFPRk211Z5VL+QA@public.gmane.org> wrote: > However, when there''s an SQL error, the entire application appears > to be silent about it. > > In dev mode, and made sure logging was explicitly set to debug. > > If I do somthing like change a field name in a table to ensure a > failure, the development.log says nothing about it. I know the > query failed, and the partial which would have displayed data from > the query doesn''t get drawn, so Rails has to be detecting failures > somewhere -- why no messages? > > Are you writing explicit queries or using a find_by_xxx where xxx > is a field that does not exist in the database? From your > description, I suspect the SQL isn''t erroring - it just isn''t > returning the results you expect. If you copy the SQL out of the > development log into mysql (or pgsql or whatever your database > querying tool is), do you get an error? or do you just get 0 rows > returned?I''m using find(:all There''s a good chance the apparaent silence is caused by something else. By changing the field name, that changes a bunch of controller/ view code as well. I''m now not convinced that the code even got as far as executing the query. I see a lot of this behavior from Rails where if something is wrong deep in a model but the impact of that isn''t realized until a partial is rendered, that the only indicator of trouble I get is that the partial does not render. NO error messages of any kind, just a specific partial doesn''t render (the rest of the page does). So, I''ve abandoned blaming the query at this point, and will eventually approach that testing another way. I''ll dig into it later. Right now I have some brain momentum going in other directions I want to let run its course. Thanks. Bill''s acknowledgement that an error dump should be generated is enough for me to know that something else going on. I''ll figure it out later. -- gw (www.railsdev.ws) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---