What's the equivalent of std::runtime_error in D?
alexandr3000
sp0148675 at gmail.com
Wed Nov 9 15:58:57 UTC 2022
On Wednesday, 9 November 2022 at 13:47:09 UTC, MorteFeuille123
wrote:
> On Wednesday, 9 November 2022 at 12:25:35 UTC, alexandr3000
> wrote:
>> ```d
>> if (vkCreateInstance(&createInfo, null, &instance) !=
>> VK_SUCCESS) {
>> ???
>> }
>> ```
>
> The official error handling system is based on exception, e.g
>
> ```d
> class VKException : Exception
> {
> this(string msg)
> {
> super(msg);
> }
> }
>
> void _()
> {
> if (vkCreateInstance(&createInfo, null, &instance) !=
> VK_SUCCESS) {
> throw new VKException("cannot create VK instance")
> }
> }
> ```
>
> manual : https://dlang.org/spec/errors.html
thanks
More information about the Digitalmars-d
mailing list