we want make s2s api return 400 HTTP error code with JSON data
{
"error": {
"code": "INVALID_USER",
"message": "Invalid user"
}
}
based on the document, we can use
throw {
code: nkruntime.Codes.INVALID_ARGUMENT, // Nakama 内部映射到 HTTP 400 错误码
message: JSON.stringify({
error: {
code: code,
message: message,
},
}),
}
but seem like the errro
attribute is build-in parameter from nakama, we cannot customised it.
we got something like this:
{
"code": 3,
"error": {
"stackTrace": "[object Object]\n\tat index.js:22676:5(10)\n\tat webhookXsollaRpc (index.js:22726:28(59))\n"
},
"message": "{\"error\":{\"code\":\"INVALID_SIGNATURE\",\"message\":\"Invalid signature\"}}"
}
is it possible to change the error
part to a customised json format?