mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix Exceptions Always Being Printed
This commit fixes the issue, that exception messages were always printed to cerr, regardless of SOL_PRINT_ERRORS setting. This also makes the inclusion of iostream completely optional, reducing binary sizes. Fixes #652.
This commit is contained in:
parent
ac709111e8
commit
f0396f8e6b
|
@ -29,7 +29,7 @@
|
|||
#include "function.hpp"
|
||||
#include "object.hpp"
|
||||
|
||||
#ifdef SOL_PRINT_ERRORS
|
||||
#if defined(SOL_PRINT_ERRORS) && SOL_PRINT_ERRORS
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <exception>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef SOL_PRINT_ERRORS
|
||||
#if defined(SOL_PRINT_ERRORS) && SOL_PRINT_ERRORS
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
|
@ -47,7 +47,7 @@ namespace sol {
|
|||
|
||||
// must push at least 1 object on the stack
|
||||
inline int default_exception_handler(lua_State* L, optional<const std::exception&>, string_view what) {
|
||||
#ifdef SOL_PRINT_ERRORS
|
||||
#if defined(SOL_PRINT_ERRORS) && SOL_PRINT_ERRORS
|
||||
std::cerr << "[sol2] An exception occurred: ";
|
||||
std::cerr.write(what.data(), what.size());
|
||||
std::cerr << std::endl;
|
||||
|
|
Loading…
Reference in New Issue
Block a user