Results 1 to 3 of 3

Thread: can you pass data back with an exception

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2005
    Posts
    150

    can you pass data back with an exception

    Hello

    I have a test application that calls a web service method.


    This method adds a document to a database, then retrives the doc id and then performs another operation using the doc id then the doc id is returned to the test application.


    Problem is if the document is added and the doc id retrieved and something goes wrong in the second oepration and an exception is thrown back then the user does not get the doc id even tho the first operation completed successfully.



    is it possible to pass the doc id back along with the exception when it is thrown.

    or

    is splitting this one method into two sub methods a betetr option and then call the sub methods seperatly from the test application?

    or what other way could i do this.

  2. #2
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    Re: can you pass data back with an exception

    You need to create your own custom Exception and return that exception then you can have access to any information you wish.

    Code:
        public class CustomExceptions : ApplicationException 
        {
            public CustomExceptions ()
                : base()
            { }
    
            public CustomExceptions (String message)
                :base(message)
            { }        
        }

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: can you pass data back with an exception

    If the entire thing is one logical transaction, then the user should not get a DOC id back. If they're two separate transactions, then yes, do make two calls to two different methods.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width