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. C#
  4. Translation of Java Error class to C#

Translation of Java Error class to C#

Scheduled Pinned Locked Moved C#
csharpjavahelpquestion
3 Posts 2 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.
  • J Offline
    J Offline
    jluber
    wrote on last edited by
    #1

    I have to convert some Java code to C# and I've stumbled over the Error class. I have been told already that the use of Error instead of Exception allows to bypass catch-clauses for all Exceptions. Now C# doesn't have a direct equivalent to Error, AFAIK. Also at the place of the Error the internal state of the program is corrupted, so abortion makes sense. Am I supposed to use the Exception or even InvalidOperationException then?

    L 1 Reply Last reply
    0
    • J jluber

      I have to convert some Java code to C# and I've stumbled over the Error class. I have been told already that the use of Error instead of Exception allows to bypass catch-clauses for all Exceptions. Now C# doesn't have a direct equivalent to Error, AFAIK. Also at the place of the Error the internal state of the program is corrupted, so abortion makes sense. Am I supposed to use the Exception or even InvalidOperationException then?

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      jluber wrote:

      Am I supposed to use the Exception or even InvalidOperationException then?

      It doesnt matter, but a more specific Exception type is preferred. Main thing it to make a clear message so the user can see what went wrong.

      xacc.ide - now with TabsToSpaces support
      IronScheme - 1.0 alpha 4a out now (29 May 2008)

      J 1 Reply Last reply
      0
      • L leppie

        jluber wrote:

        Am I supposed to use the Exception or even InvalidOperationException then?

        It doesnt matter, but a more specific Exception type is preferred. Main thing it to make a clear message so the user can see what went wrong.

        xacc.ide - now with TabsToSpaces support
        IronScheme - 1.0 alpha 4a out now (29 May 2008)

        J Offline
        J Offline
        jluber
        wrote on last edited by
        #3

        Will do so. Thanks for the clarification!

        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