Split error macro into two versions (format vs non-formating) to allow format checking at compile-time

This commit is contained in:
SirLynix
2023-11-02 15:18:03 +01:00
parent 8fb53f467b
commit 4b8a475bbd
133 changed files with 570 additions and 557 deletions

View File

@@ -43,7 +43,7 @@ int main()
std::shared_ptr<Nz::Mesh> spaceshipMesh = Nz::Mesh::LoadFromFile(resourceDir / "Spaceship/spaceship.obj", meshParams);
if (!spaceshipMesh)
{
NazaraError("Failed to load model");
NazaraError("failed to load model");
return __LINE__;
}
@@ -53,7 +53,7 @@ int main()
std::shared_ptr<Nz::Image> diffuseImage = Nz::Image::LoadFromFile(resourceDir / "Spaceship/Texture/diffuse.png");
if (!diffuseImage || !diffuseImage->Convert(Nz::PixelFormat::RGBA8_SRGB))
{
NazaraError("Failed to load image");
NazaraError("failed to load image");
return __LINE__;
}

View File

@@ -132,7 +132,7 @@ int main()
std::shared_ptr<Nz::Mesh> spaceship = Nz::Mesh::LoadFromFile(resourceDir / "Spaceship/spaceship.obj", meshParams);
if (!spaceship)
{
NazaraError("Failed to load model");
NazaraError("failed to load model");
return __LINE__;
}

View File

@@ -12,14 +12,14 @@ SCENARIO("Error", "[CORE][ERROR]")
{
THEN("These errors should be written in the log file")
{
Nz::Error::Trigger(Nz::ErrorType::Internal, "ErrorType::{0}", "Internal");
Nz::Error::Trigger(Nz::ErrorType::Internal, 2, "Error.cpp", "2nd place Internal", "ErrorType::{0}", "Internal");
Nz::Error::Trigger(Nz::ErrorType::Internal, Nz::Format("ErrorType::{0}", "Internal"));
Nz::Error::Trigger(Nz::ErrorType::Internal, 2, "Error.cpp", "2nd place Internal", Nz::Format("ErrorType::{0}", "Internal"));
REQUIRE("ErrorType::Internal" == Nz::Error::GetLastError());
Nz::Error::Trigger(Nz::ErrorType::Normal, "ErrorType::{1}{0}", "mal", "Nor");
Nz::Error::Trigger(Nz::ErrorType::Normal, 2, "Error.cpp", "2nd place Normal", "ErrorType::{1}{0}", "mal", "Nor");
Nz::Error::Trigger(Nz::ErrorType::Normal, Nz::Format("ErrorType::{1}{0}", "mal", "Nor"));
Nz::Error::Trigger(Nz::ErrorType::Normal, 2, "Error.cpp", "2nd place Normal", Nz::Format("ErrorType::{1}{0}", "mal", "Nor"));
REQUIRE("ErrorType::Normal" == Nz::Error::GetLastError());
Nz::Error::Trigger(Nz::ErrorType::Warning, "ErrorType::Warning");
Nz::Error::Trigger(Nz::ErrorType::Warning, "ErrorType::Warning", 2, "Error.cpp", "2nd place Warning");
Nz::Error::Trigger(Nz::ErrorType::Warning, Nz::Format("ErrorType::Warning", 2, "Error.cpp", "2nd place Warning"));
REQUIRE("ErrorType::Normal" == Nz::Error::GetLastError()); //< Warning are not captured by GetLastError
}
}