<% begin %> <% productcode = "" category = "" subcategory = "" gender = "" material = "" myimages = "#{root_url}images/no-image.jpg" if products productcode = products.pd_id category = products.pd_category subcategory = products.pd_subcategory materialobj=get_basic_information(products.pd_compcode,products.pd_id) if materialobj material = materialobj.pd_bsc_material gender = materialobj.pd_bsc_gender end end %> <% message = "" rescue ActiveRecord::RecordNotFound => e # Handle the specific exception when the record is not found message = "Record not found "##{e.message} isFlags = false rescue ActiveRecord::StatementInvalid => e # Handle SQL syntax errors or invalid queries message = "Unknown error " ##{e.message} isFlags = false rescue StandardError => e # Handle any other errors message = "An error occurred" ##{e.message} isFlags = false end %> <%=message%>