I would like to log errors that happen in my server-side business objects. Unfortunately, the error object is empty and I don’t know why. Here an example:
try {
var myVal = 5;
Simplifier.Connector.MyConnector.update(myVal);
} catch (e) {
Simplifier.Log.error(“My error”, e);
throw new Error(“Could not update”);
}
The entry in the Simplifier log is there, but when I click on the “i” icon, I only see “Undefined” or “{}”. I would expect to get the error message from my connector call, e.g., if the SQL statement cannot be executed.
Is there an error in my code?
Thank you!
Daniel
Has successfully completed the online course Introduction
Has successfully completed the online course Intermediate (200)
Has successfully completed the online course Advanced (300)
Has successfully completed the online course Basics (100)
Using Simplifier.Log.Error(“My error”, e.message) should give you the result you’re looking for.
This is a bit counterintuitive and confusing but this is how the Error object in javascript works.
You can find more information about the Error object here.
thank you very much! I expected that “e” behaves like in the Java world, i.e. being a regular object. Using the three attributes of e works great, thank you!