Menu

#60 Introduce an exception hierarchy

Backlog
open
nobody
None
nobody
2021-01-16
2016-03-03
Ulf Lorenz
No

In utils/wp_exceptions.hpp, we already introduce some wavepacket-specific exceptions. However, some exceptions and exception use cases are missing, so at several places we resort to exceptions from the standard library.

The goal of this issue is to design a wavepacket-specific exception hierarchy. All wavepacket code should only throw wavepacket exceptions, hence adaption of the code is also required. Look at what is thrown and add the missing exceptions.

Unsorted thoughts relevant to this issue:

  • InvalidValueException is complicated to use. This could be avoided by having an easy way to format strings in printf style and just printing the problematic value. boost has such a formatting library, how heavy is it?
  • We lack various exceptions
    • time-dependent operator where a time-independent one is required
    • incorrect grid type
    • invalid arguments (!= InvalidValueException), e.g., a list with the wrong number of elements
    • Exception for numerical errors, when the output is invalid
    • general procedure errors when something in a complex factory/ class goes wrong or so.
  • Exceptions that are triggered by other exceptions should generally throw the original cause with the new exception. That would make debugging way easier.

Discussion

  • Ulf Lorenz

    Ulf Lorenz - 2017-11-11
    • Milestone: Backlog --> 0.3 goal
     
  • Ulf Lorenz

    Ulf Lorenz - 2018-02-10
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,5 +4,8 @@
    
     Unsorted thoughts relevant to this issue:
    
    -* We lack an exception related to bad input data (wrong grid type, time-dependent operator where a time-independent one is required etc.)
     * InvalidValueException is complicated to use. This could be avoided by having an easy way to format strings in printf style and just printing the problematic value. boost has such a formatting library, how heavy is it?
    +* We lack various exceptions
    +    * time-dependent operator where a time-independent one is required
    +    * incorrect grid type
    +    * invalid arguments (!= InvalidValueException), e.g., an operator with the wrong representation
    
     
  • Ulf Lorenz

    Ulf Lorenz - 2018-12-24
    • Milestone: 0.3 goal --> Backlog
     
  • Ulf Lorenz

    Ulf Lorenz - 2019-02-17
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -9,3 +9,4 @@
         * time-dependent operator where a time-independent one is required
         * incorrect grid type
         * invalid arguments (!= InvalidValueException), e.g., an operator with the wrong representation
    +* Exceptions that are triggered by other exceptions should generally throw the original cause with the new exception. That would make debugging way easier.
    
     
  • Ulf Lorenz

    Ulf Lorenz - 2020-08-30
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -5,6 +5,7 @@
     Unsorted thoughts relevant to this issue:
    
     * InvalidValueException is complicated to use. This could be avoided by having an easy way to format strings in printf style and just printing the problematic value. boost has such a formatting library, how heavy is it?
    +* BadGridException combines two usages: if a state is invalid and if a grid does not match an expected grid. These should be disentangled and split into two separate exceptions
     * We lack various exceptions
         * time-dependent operator where a time-independent one is required
         * incorrect grid type
    
     
  • Ulf Lorenz

    Ulf Lorenz - 2020-11-08
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -5,7 +5,6 @@
     Unsorted thoughts relevant to this issue:
    
     * InvalidValueException is complicated to use. This could be avoided by having an easy way to format strings in printf style and just printing the problematic value. boost has such a formatting library, how heavy is it?
    -* BadGridException combines two usages: if a state is invalid and if a grid does not match an expected grid. These should be disentangled and split into two separate exceptions
     * We lack various exceptions
         * time-dependent operator where a time-independent one is required
         * incorrect grid type
    
     
  • Ulf Lorenz

    Ulf Lorenz - 2020-11-08

    BadGridException has been fixed in passing in [#121]

     

    Related

    Tickets: #121

  • Ulf Lorenz

    Ulf Lorenz - 2021-01-16
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -8,5 +8,7 @@
     * We lack various exceptions
         * time-dependent operator where a time-independent one is required
         * incorrect grid type
    -    * invalid arguments (!= InvalidValueException), e.g., an operator with the wrong representation
    +    * invalid arguments (!= InvalidValueException), e.g., a list with the wrong number of elements
    +    * Exception for numerical errors, when the output is invalid
    +    * general procedure errors when something in a complex factory/ class goes wrong or so.
     * Exceptions that are triggered by other exceptions should generally throw the original cause with the new exception. That would make debugging way easier.
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.