How to log errors/exceptions in Business Objects?
-
Christian
3 years ago #30128Hi all
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)
3 years ago #30129::Hi Christian,
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.Hope this helps!
Best regards,
Dan
You must be logged in to reply to this topic.