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. General Programming
  3. Design and Architecture
  4. Exception Tolerance

Exception Tolerance

Scheduled Pinned Locked Moved Design and Architecture
databasetestingbeta-testingxmlquestion
7 Posts 3 Posters 0 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.
  • B Offline
    B Offline
    Brady Kelly
    wrote on last edited by
    #1

    I have an Export Engine that uses an XML export definition to create mainly CSV files from a database.  I would like to build in exception tolerance at the field and line level, so that when testing a new definition or a change to a definition, I just log all exceptions, and deal with them as a batch after a test run, rather than have the run abort at each new exception found.  Exceptions that should be tolerated are invalid field names, null values etc. Are there any established patterns for implementing this?

    Pits fall into Chuck Norris.

    P P 2 Replies Last reply
    0
    • B Brady Kelly

      I have an Export Engine that uses an XML export definition to create mainly CSV files from a database.  I would like to build in exception tolerance at the field and line level, so that when testing a new definition or a change to a definition, I just log all exceptions, and deal with them as a batch after a test run, rather than have the run abort at each new exception found.  Exceptions that should be tolerated are invalid field names, null values etc. Are there any established patterns for implementing this?

      Pits fall into Chuck Norris.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      I would use a validation engine for this, and just build up a list of validation failures. The beauty of a validation engine is that you can add rules iteratively and the engine should be able to cope. I wrote part of one a while back that you are more than welcome to take and add your rules to. Send me a mail for it.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      B 1 Reply Last reply
      0
      • P Pete OHanlon

        I would use a validation engine for this, and just build up a list of validation failures. The beauty of a validation engine is that you can add rules iteratively and the engine should be able to cope. I wrote part of one a while back that you are more than welcome to take and add your rules to. Send me a mail for it.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #3

        Thanks Pete, I'd love to have a look at your engine, but what are you suggesting I validate?  The definition, i.e. does the query execute, do all the output fields map correctly to input fields etc?  Or validate every row of input data against the output schema?

        Pits fall into Chuck Norris.

        P 1 Reply Last reply
        0
        • B Brady Kelly

          Thanks Pete, I'd love to have a look at your engine, but what are you suggesting I validate?  The definition, i.e. does the query execute, do all the output fields map correctly to input fields etc?  Or validate every row of input data against the output schema?

          Pits fall into Chuck Norris.

          P Offline
          P Offline
          Pete OHanlon
          wrote on last edited by
          #4

          It's up to you what you validate, but you could do things like validate that mandatory fields aren't null, that field types don't conflict with field values - that type of thing.

          Deja View - the feeling that you've seen this post before.

          My blog | My articles

          B 1 Reply Last reply
          0
          • P Pete OHanlon

            It's up to you what you validate, but you could do things like validate that mandatory fields aren't null, that field types don't conflict with field values - that type of thing.

            Deja View - the feeling that you've seen this post before.

            My blog | My articles

            B Offline
            B Offline
            Brady Kelly
            wrote on last edited by
            #5

            I've decided, in light of this being a financial application, any exception handling or avoidance, is not worth the risk, so I'm revising my strategy to only possibly increase the number of exceptions thrown. Applying a validation engine here would be overkill, as most operations generate exceptions for fault conditions, e.g. invalid field names, but I'd still like to see your engine and maybe use it as inspiration elsewhere.

            P 1 Reply Last reply
            0
            • B Brady Kelly

              I've decided, in light of this being a financial application, any exception handling or avoidance, is not worth the risk, so I'm revising my strategy to only possibly increase the number of exceptions thrown. Applying a validation engine here would be overkill, as most operations generate exceptions for fault conditions, e.g. invalid field names, but I'd still like to see your engine and maybe use it as inspiration elsewhere.

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              Brady - send me an email (through the email link here) so that I can get an address to send the project to.

              Deja View - the feeling that you've seen this post before.

              My blog | My articles

              1 Reply Last reply
              0
              • B Brady Kelly

                I have an Export Engine that uses an XML export definition to create mainly CSV files from a database.  I would like to build in exception tolerance at the field and line level, so that when testing a new definition or a change to a definition, I just log all exceptions, and deal with them as a batch after a test run, rather than have the run abort at each new exception found.  Exceptions that should be tolerated are invalid field names, null values etc. Are there any established patterns for implementing this?

                Pits fall into Chuck Norris.

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #7

                Maybe have it raise events rather than throw exceptions, perhaps when in a "testing" mode or something.

                try
                {
                // Do something
                }
                catch ( System.Exception err )
                {

                if Testing

                OnExceptionCaught ( err ) ;
                

                else

                throw ( err ) ; // Hopefully with additional info, of course
                

                endif

                }

                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