inexorgame / vulkan-renderer

A new 3D game engine for Linux and Windows using C++20 and Vulkan API 1.3, in very early but ongoing development
https://inexor.org
MIT License
777 stars 34 forks source link

Use std::source_location in exceptions #468

Open IAmNotHanni opened 2 years ago

IAmNotHanni commented 2 years ago

Is your feature request related to a problem?

When an InexorException is thrown, we don't store any information about the source location in it.

Description

We could use the new C++20 feature std::source_location to store information about the origin of the exception.

Alternatives

Do not use std::source_location at all

Affected Code

all of the code

Operating System

all operating systems

Additional Context

https://en.cppreference.com/w/cpp/utility/source_location

IAmNotHanni commented 2 years ago

Ah nice: we can just offer std::source_location::current()) as a default argument and it will tell us in the exception message where the error occured in the code.