Skip to content

Commit 83e5f70

Browse files
committed
fixup! src: assign ERR_SCRIPT_EXECUTION_* codes in C++
1 parent 56a6434 commit 83e5f70

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/node_errors.h

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
#include "env-inl.h"
99
#include "v8.h"
1010

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

1315
namespace node {
1416

@@ -70,10 +72,10 @@ namespace node {
7072
// Errors with predefined non-static messages
7173
inline void THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(Environment* env,
7274
int64_t timeout) {
73-
char message[128];
74-
snprintf(message, sizeof(message),
75-
"Script execution timed out after %" PRId64 "ms", timeout);
76-
THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message);
75+
std::ostringstream message;
76+
message << "Script execution timed out after ";
77+
message << timeout << "ms";
78+
THROW_ERR_SCRIPT_EXECUTION_TIMEOUT(env, message.str().c_str());
7779
}
7880

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

0 commit comments

Comments
 (0)