nibsy Posted June 4, 2003 Posted June 4, 2003 I have an application which analyses website usage logs. The program reads in a file to analyse. I received the following error message when running the application: System.ArgumentException: Found a high surrogate char without a following low surrogate at index: 546. This input may not be in this encoding, or may not contain valid unicode (UTF-16) characters. Inspecting the website logs manually it seems there is some unexpected corrupt data within the file. I was wondering if there was a way of catching this error to stop the program crashing? Any help will be gratefully received. Quote
Leaders dynamic_sysop Posted June 4, 2003 Leaders Posted June 4, 2003 Try Shell("", AppWinStyle.NormalFocus, True) '// your code would go here '/// i made this to purposely throw an error '/// basically it tries to open something that doesnt exsist Catch MsgBox("error: " & Err.Description) End Try hope this helps Quote
nibsy Posted June 4, 2003 Author Posted June 4, 2003 Thanks for the help! Is there a way of catching this specific error? Quote
Administrators PlausiblyDamp Posted June 4, 2003 Administrators Posted June 4, 2003 to steal somebody else's code Try Shell("", AppWinStyle.NormalFocus, True) '// your code would go here '/// i made this to purposely throw an error '/// basically it tries to open something that doesnt exsist Catch ex as System.ArgumentException 'Use this here MsgBox("error: " & ex.Message) 'Also look at ex.ParamName End Try this also allows you to catch multiple different errors try 'Iffy code here catch ex as System.ArgumentException 'handle error here catch ex as System.InvalidCastException 'handle type mismatch end try hope that helps Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Heiko Posted June 4, 2003 Posted June 4, 2003 Try ... Catch e1 as System.ArgumentException ... Catch e as Exception ... Finally ... End Try Quote .nerd
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.