Throw Non-FATAL Exception with INFO log level entry
A
Artem Hofmann
started a topic
over 6 years ago
Hi all,
I want to throw an exception in a specific situation. My problem is that in the log database, the log level has the type FATAL. But I want it to be INFO. Is it possible?
if(someCondition) {
throw "error message"; // -> this will be a FATAL log entry; but need INFO
}
thank you! On the top of that I found a well suited solution for my problem. See below...
// ====================================================================================================
//
// Cloud Code for TestException, write your code here to customise the GameSparks platform.
//
// For details of the GameSparks Cloud Code API see https://portal.gamesparks.net/docs.htm
//
// ====================================================================================================
var throwError = true;
main();
function main() {
if(throwError) {
Spark.setScriptError("data", "someData"); // set error message or code
Spark.setScriptData("data2", {"name" : "someName"}); // add additional data to the response
Spark.getLog().info("INFO TEST"); // insert log entry at the preferred log level
return; // cancel further execution of the code
}
throw "FATAL Exception"; // will be never called if 'throwError' == true
}
Artem Hofmann
Hi all,
I want to throw an exception in a specific situation. My problem is that in the log database, the log level has the type FATAL. But I want it to be INFO. Is it possible?
Hi Artem,
Our database logging is handled with SparkLog. I've linked the relevant tutorial here: https://docs.gamesparks.com/api-documentation/cloud-code-api/utilities/sparklog.html
Hope this helps,
- Steve
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Artem,
Our database logging is handled with SparkLog. I've linked the relevant tutorial here: https://docs.gamesparks.com/api-documentation/cloud-code-api/utilities/sparklog.html
Hope this helps,
- Steve
Artem Hofmann
Hi Steve,
thank you! On the top of that I found a well suited solution for my problem. See below...
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics