Re: Error reporting
- Posted by fizzpopsoft Jan 12, 2014
- 1403 views
Here is a sample of my code, so its clear on how I stand on "quick and dirty" :
-- -- v5013 check for old or new excel type by checking the date record -- old excel has trailing 13 commas, new has trailing 16 commas -- if sf = 1 then -- this record seems to be a valid date.... if excel_type = 0 then -- excel type has not been checked yet if match(",,,,,,,,,,,,,,,,",s1) > 7 then excel_type = 2 if debug_level > 1 then writelog("Debug 1 CSV data seems to be of modern excel type") end if else if match(",,,,,,,,,,,,,",s1) > 7 then excel_type = 1 writelog("Debug 1 CSV data seems to be of old excel type") if batchmode = 0 then msgbox = message_box("Your data appears to be converted \n" & " from a old excel version into CSV!\n" & "Only excel 97 to 2000 is supported.\n" & "Ensure the correct excel version before saving as msdos-CSV", "Fatal error - invalid CSV data!",MB_ICONHAND) -- abort(8) else writelog("Debug 0 only excel version 97 to 2000 is supported.") writelog("Debug 0 Ensure that is so before saving as msdos-CSV.") -- abort(8) end if end if end if end if
IMHO Its clear, somewhat wordy, commented. Its from a 9500 line program, so it has to be easily understood for sanity purposes.
But this thread has been sidetracked to be about coding style! That's not it, its about a clearer error message.
Please gents, if the error reporting can be clearer, then make it so rather than advocating coding style changes to hide the deficiency.
Anyway, Matt has opened ticket 883 to improve the error message so I'll leave it at that.
Regards,
Alan