I suggest you ...

Add a feature to compiler to translate {throw "ddd";} to {throw new Exception("ddd");}

It would be great to have a compiler support for short style exception throwing.
So instead of writing the folloowing exception throwing line:
throw new Exception("Unknown configuration");
one could write the short way, as follows:
throw "Unknown configuration";

1 vote
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Artak MkrtchyanArtak Mkrtchyan shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    1 comment

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • PhilippePhilippe commented  ·   ·  Flag as inappropriate

        It is not recommanded an exception on that type as it is too generic... and it would not be a good idea for the compiler to give shortcut to code we should not write in the first place. You should typically use your own exception classes or use existing and more specific exceptions classes when appropriate.

      Feedback and Knowledge Base