From 52ffe979b75f95e30e35e6c0608d3c0d40a42b02 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 30 Apr 2002 22:08:29 +0000 Subject: [PATCH] moved exception handling out of c++ functions --- src/ca/syncgrp.cpp | 82 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 4 deletions(-) diff --git a/src/ca/syncgrp.cpp b/src/ca/syncgrp.cpp index 56622bad9..bb260b5cb 100644 --- a/src/ca/syncgrp.cpp +++ b/src/ca/syncgrp.cpp @@ -204,8 +204,47 @@ extern "C" int epicsShareAPI ca_sg_array_put ( const CA_SYNC_GID gid, chtype typ return ECA_BADSYNCGRP; } - return pcasg->put ( pChan, type, - static_cast < unsigned > ( count ), pValue ); + try { + pcasg->put ( pChan, type, + static_cast < unsigned > ( count ), pValue ); + return ECA_NORMAL; + } + catch ( cacChannel::badString & ) + { + return ECA_BADSTR; + } + catch ( cacChannel::badType & ) + { + return ECA_BADTYPE; + } + catch ( cacChannel::outOfBounds & ) + { + return ECA_BADCOUNT; + } + catch ( cacChannel::noWriteAccess & ) + { + return ECA_NOWTACCESS; + } + catch ( cacChannel::notConnected & ) + { + return ECA_DISCONN; + } + catch ( cacChannel::unsupportedByService & ) + { + return ECA_NOTINSERVICE; + } + catch ( cacChannel::requestTimedOut & ) + { + return ECA_TIMEOUT; + } + catch ( std::bad_alloc & ) + { + return ECA_ALLOCMEM; + } + catch ( ... ) + { + return ECA_INTERNAL; + } } /* @@ -228,6 +267,41 @@ extern "C" int epicsShareAPI ca_sg_array_get ( const CA_SYNC_GID gid, chtype typ return ECA_BADSYNCGRP; } - return pcasg->get ( pChan, type, - static_cast < unsigned > ( count ), pValue ); + try { + pcasg->get ( pChan, type, + static_cast < unsigned > ( count ), pValue ); + return ECA_NORMAL; + } + catch ( cacChannel::badString & ) + { + return ECA_BADSTR; + } + catch ( cacChannel::badType & ) + { + return ECA_BADTYPE; + } + catch ( cacChannel::outOfBounds & ) + { + return ECA_BADCOUNT; + } + catch ( cacChannel::noReadAccess & ) + { + return ECA_NORDACCESS; + } + catch ( cacChannel::notConnected & ) + { + return ECA_DISCONN; + } + catch ( cacChannel::unsupportedByService & ) + { + return ECA_NOTINSERVICE; + } + catch ( std::bad_alloc & ) + { + return ECA_ALLOCMEM; + } + catch ( ... ) + { + return ECA_INTERNAL; + } }