Skip to content

Commit

Permalink
use string literals
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev committed Dec 26, 2023
1 parent ea8e616 commit 909be47
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/noobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <nofunction.h>
#include <notypes.h>

using namespace std::literals::string_literals;

namespace Nobind {

struct EmptyEnvInstanceData {};
Expand Down Expand Up @@ -357,7 +359,7 @@ NoObjectWrap<CLASS>::NoObjectWrap(const Napi::CallbackInfo &info) : Napi::Object
}
}
throw Napi::TypeError::New(info.Env(),
"No constructor with the given " + std::to_string(info.Length()) + " arguments found");
"No constructor with the given "s + std::to_string(info.Length()) + " arguments found"s);
}

template <typename CLASS>
Expand Down Expand Up @@ -394,7 +396,7 @@ template <typename CLASS> inline CLASS *NoObjectWrap<CLASS>::CheckUnwrap(Napi::V
Napi::Object obj = val.ToObject();
auto instance = env.GetInstanceData<BaseEnvInstanceData>();
if (!obj.InstanceOf(instance->_Nobind_cons[class_idx].Value())) {
throw Napi::TypeError::New(env, "Expected a " + name);
throw Napi::TypeError::New(env, "Expected a "s + (name.size() > 0 ? name : "<unknown to nobind17 class>"s));
}
return NoObjectWrap<CLASS>::Unwrap(obj)->self;
}
Expand Down

0 comments on commit 909be47

Please sign in to comment.