Error messages



  • Seen in code at work, I love error messages like this :D.

    try
    {
    FileManager.Save(Data, OpenCurrentFileStream(System.IO.FileAccess.ReadWrite) );
    }
    catch( System.UnauthorizedAccessException )
    {
    MessageBox.Show("File is probably Read Only, check it out or something", "Save Error");
    }

    Edit: how do you retain original formatting? :S



  • try the <pre> tag:

    try { 
        FileManager.Save(Data, OpenCurrentFileStream(System.IO.FileAccess.ReadWrite) ); 
    } catch (System.UnauthorizedAccessException) { 
        MessageBox.Show("File is probably Read Only, check it out or something", "Save Error"); 
    }
    

  • :belt_onion:

    @xan said:

    Seen in code at work, I love error messages like this :D.

    try {

     <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>   FileManager.Save(Data, OpenCurrentFileStream(System.IO.FileAccess.ReadWrite) ); <o:p></o:p>
    } catch( System.UnauthorizedAccessException ) <o:p></o:p>

    {

       MessageBox.Show("File is probably Read Only, check it out or something", "Save Error");

    <o:p></o:p>} <o:p></o:p>



  • @snoofle said:

    try the <pre> tag:

    try {
    FileManager.Save(Data, OpenCurrentFileStream(System.IO.FileAccess.ReadWrite) );
    } catch (System.UnauthorizedAccessException) {
    MessageBox.Show("File is probably Read Only, check it out or something", "Save Error");
    }

    Many thanks :)


Log in to reply