vblang icon indicating copy to clipboard operation
vblang copied to clipboard

[Proposal] Include more specific exceptions. Or Exception Interfaces

Open AdamSpeight2008 opened this issue 5 years ago • 3 comments

Specific Exception for improved contextual information

For example ArgumentOutOfRangeException doesn't indicate how the argument is out the range in context to this specific range. It could be

  • before the start of the range?
    • as the indices range of an ICollection
    • eg a BeforeRange_ArgumentOutOfRangeException
  • after the end of the range?
    • as the indices range of an ICollection
    • eg an AfterRange_ArgumentOutOfRangeException
  • not a valid step within the range / sequence?
    • as in the sequence Enumerable.Range(0, 100).Where( Function(index) (index Mod 3) = 0 )

Exception Interfaces

Allow an Interface to only to explicitly be implemented inheritors of the Exception base class, or it also inherits the IException base-class interface.

Exception Interface IOutOfRange_ArgumentException
  Inherit IArgument_Exception
  '  ...
End Interface

Interface is now become more abstract in it definition., which allow to progress towards developing a Concept-like implementation, for some future version (or fork) of Visual Basic.net.

AdamSpeight2008 avatar Aug 15 '20 21:08 AdamSpeight2008

This issue belongs to .NET runtime repository, right?

hartmair avatar Aug 16 '20 04:08 hartmair

@hartmair Not necessarily so, vb.net can provide additional exception via a library.

AdamSpeight2008 avatar Aug 16 '20 17:08 AdamSpeight2008

Where are these exceptions coming from? Are you proposing adding extra exception classes for user code to utilize, rewriting the framework libraries to use these extra exceptions, or suggesting some sort of intercept mechanism to transform the framework library exceptions into these more detailed ones?

gilfusion avatar Aug 17 '20 17:08 gilfusion