Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! src: assign ERR_SCRIPT_EXECUTION_* codes in C++
  • Loading branch information
joyeecheung committed Apr 23, 2018
commit 83e5f70c4d80a1c5ee189adddc0c9f978be9a9e3
12 changes: 7 additions & 5 deletions src/node_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#include "env-inl.h"
#include "v8.h"

#include <inttypes.h>
// Use ostringstream to print exact-width integer types
// because the format specifiers are not available on AIX.
#include <sstream>

namespace node {

Expand Down Expand Up @@ -70,10 +72,10 @@ namespace node {
// Errors with predefined non-static messages
inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env,
int64_t timeout) {
char message[128];
snprintf(message, sizeof(message),
"Script execution timed out after %" PRId64 "ms", timeout);
THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message);
std::ostringstream message;
message << "Script execution timed out after ";
message << timeout << "ms";
THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message.str().c_str());
}

inline v8::Local<v8::Value> ERR_BUFFER_TOO_LARGE(v8::Isolate *isolate) {
Expand Down