Results 1 to 2 of 2

Thread: User exceptions for AMI?

  1. #1
    jharriot is offline Registered User
    Name: John Harriott
    Organization: BAE Systems
    Project: P3 Mid Life Upgrade
    Join Date
    Mar 2007
    Posts
    30

    User exceptions for AMI?

    Hi,

    Configuration: Ice=3.3.1, VS2009, WinXP, Language C#

    I have created a user exception in the Ice file.

    exception TickError;
    ["ami"] void Tick() throws TickError;


    The server side code throws a TickError exception and the argument for TickError is a custom .net exception


    void Tick(Ice.Current current__)
    {
    try
    {
    ... blah

    throw new CustomException("My message");

    ... blah
    }
    catch (CustomException ex)
    {
    throw new TickError(ex);
    }
    }


    The client side implements the ice_exception(Ice.Exception ex) method. However I cannot obtain the message that was used to create CustomException. The Message field of the exception received by ice_exception() contains the type of message, eg ex.Message = SDS.Slice.TickError.
    Last edited by jharriot; 08-20-2010 at 03:32 AM.

  2. #2
    jharriot is offline Registered User
    Name: John Harriott
    Organization: BAE Systems
    Project: P3 Mid Life Upgrade
    Join Date
    Mar 2007
    Posts
    30

    Problem solved

    I modified the Ice async example code and the following approach appears to work.

    Slice file:
    Code:
    exception RequestCanceledException
    {
       string reason;
    }

    Server side:
    Code:
    entry.cb.ice_exception(new RequestCanceledException("hi there"));
    Client side:
    Code:
    public override void ice_exception(Ice.Exception ex)
    {
          try
          {
              throw ex;
          }
          catch (RequestCanceledException ex1)
          {
               Console.Error.WriteLine("Error: {0}", ex1.reason);
          }
    }

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. 'local' user exceptions possible?
    By kpfleming in forum Help Center
    Replies: 3
    Last Post: 03-17-2011, 11:28 AM
  2. Idempotent and user exceptions
    By Pompei2 in forum Help Center
    Replies: 2
    Last Post: 08-26-2009, 05:39 AM
  3. User manual
    By iivdam in forum Bug Reports
    Replies: 1
    Last Post: 04-09-2009, 09:37 AM
  4. AMI or not AMI depending on slice args?
    By stepancheg in forum Help Center
    Replies: 2
    Last Post: 02-26-2008, 03:00 PM
  5. Replies: 4
    Last Post: 06-15-2007, 03:47 AM

Posting Permissions

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