Err.Raise in EnterpriseServices Component

Here is the situation.

I have custom err.raise statement Err.Raise(vbObjectError+9000, src, desc) in an ES component. And when the client tries to trap the error, the error number that is returned is always 5, but I can get src and desc values. Is there any known problem with errors raised from ES component

Thanks.

ramesh nd.



Answer this question

Err.Raise in EnterpriseServices Component

  • CV 8.0

    The workaround is throw COM exception like this:

    throw New COMException(Err.Exception, vbObjectError + 9500)

    there is a marshaling problem if you use Err.Raise(vbObjectError + 9500) in ES component.

    Note: You can use Throw inside On Error Goto block, and it works.

  • Nate McMurtray

    actually we are in the process of migrating vb6 components into .NET, and concentrating more on the VB6 biz components to be migrated properly; so we are kinda struck with the vb way of error handling for the time being... however if there is no solution for error 5 problem, then we would rather go with exceptions!

    thanks.

  • DirkR

    I would throw an exception instead of using err.raise 



  • Rob Clapham

    I'd saied that not would but u MUST throw exceptions.
    .NET is type-based system, we should forgot about code errors at all.
    I recomend author to read this article about Exception Management http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnbda/html/exceptdotnet.asp

  • Err.Raise in EnterpriseServices Component