Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Exception handling found in ...

Exception handling found in ...

Scheduled Pinned Locked Moved The Weird and The Wonderful
help
7 Posts 6 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    catch(Exception e)
    {
    throw new Exception("Error while processing file");
    }

    I could just cry.

    P Z R V 4 Replies Last reply
    0
    • L Lost User

      catch(Exception e)
      {
      throw new Exception("Error while processing file");
      }

      I could just cry.

      P Offline
      P Offline
      PeejayAdams
      wrote on last edited by
      #2

      Well, it does confirm that it was during the processing of the file rather than before or after it. Yes, a pedant might bemoan the suppression of detail about what the error was but the writer has at least given a clue as to when it occurred.

      98.4% of statistics are made up on the spot.

      L S 2 Replies Last reply
      0
      • P PeejayAdams

        Well, it does confirm that it was during the processing of the file rather than before or after it. Yes, a pedant might bemoan the suppression of detail about what the error was but the writer has at least given a clue as to when it occurred.

        98.4% of statistics are made up on the spot.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Well that would be fun in a try block greater than 10-15 lines of code.

        1 Reply Last reply
        0
        • L Lost User

          catch(Exception e)
          {
          throw new Exception("Error while processing file");
          }

          I could just cry.

          Z Offline
          Z Offline
          Z C M
          wrote on last edited by
          #4

          I'll trade you. Actual production code.

          if (!string.IsNullOrEmpty(results))
          {
          // Add your error handling here.
          }

          "...JavaScript could teach Dyson how to suck." -- Nagy Vilmos

          1 Reply Last reply
          0
          • L Lost User

            catch(Exception e)
            {
            throw new Exception("Error while processing file");
            }

            I could just cry.

            R Offline
            R Offline
            raddevus
            wrote on last edited by
            #5

            This is a special conversion method, which converts ALL exceptions into "Error processing file". :rolleyes: Very valuable. :laugh:

            1 Reply Last reply
            0
            • P PeejayAdams

              Well, it does confirm that it was during the processing of the file rather than before or after it. Yes, a pedant might bemoan the suppression of detail about what the error was but the writer has at least given a clue as to when it occurred.

              98.4% of statistics are made up on the spot.

              S Offline
              S Offline
              Super Lloyd
              wrote on last edited by
              #6

              In that light the following would be better:

              throw new Exception(message, oldException);

              A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

              1 Reply Last reply
              0
              • L Lost User

                catch(Exception e)
                {
                throw new Exception("Error while processing file");
                }

                I could just cry.

                V Offline
                V Offline
                virang_21
                wrote on last edited by
                #7

                This is a design pattern : Encapsulation by Deception ! ;P

                Zen and the art of software maintenance : rm -rf * Maths is like love : a simple idea but it can get complicated.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups