• Christian
        2 years ago #30128

        Hi 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)
          2 years ago #30129
          Up
          2
          Down
          ::

          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

          Christian
              2 years ago #30130
              Up
              0
              Down
              ::

              Hi Dan,

              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!

              Best regards

              Christian

            Viewing 3 posts - 1 through 3 (of 3 total)

            You must be logged in to reply to this topic.