www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Exception2 described in blog post

reply Adam D Ruppe <destructionator gmail.com> writes:
```
import exception2;
void main() {
         int a;

         try {
		// string error type instead of namespaced D type
		// can still attach information though
                 throw Exception2!"foo bar"(a);
         } catch(Exception2!"foo bar") { // caught by string
                // printing it here would show the value of `a`
         }
}
```

Read more at the link:
http://dpldocs.info/this-week-in-d/Blog.Posted_2022_08_01.html
Aug 01 2022
parent Alexandru Ermicioi <alexandru.ermicioi gmail.com> writes:
On Monday, 1 August 2022 at 23:04:57 UTC, Adam D Ruppe wrote:
 ```
 import exception2;
 void main() {
         int a;

         try {
 		// string error type instead of namespaced D type
 		// can still attach information though
                 throw Exception2!"foo bar"(a);
         } catch(Exception2!"foo bar") { // caught by string
                // printing it here would show the value of `a`
         }
 }
 ```

 Read more at the link:
 http://dpldocs.info/this-week-in-d/Blog.Posted_2022_08_01.html
It won't play well with autocomplete :(.
Aug 02 2022