Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Entwicklung
    4. [beantwortet: Frage] adapter.on( … catch (e), woher kommt e?

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [beantwortet: Frage] adapter.on( … catch (e), woher kommt e?

    This topic has been deleted. Only users with topic management privileges can see it.
    • ruhr70
      ruhr70 last edited by

      Eine Frage zum catch (e) vom Template-Adapter.

      Woher kommt das e?

      // is called when adapter shuts down - callback has to be called under any circumstances!
      adapter.on('unload', function (callback) {
          adapter.log.info("#### adapter.on('unload' ####");
          try {
              adapter.log.info('cleaned everything up...');
              callback();
          } catch (e) {
              callback();
          }
      });
      
      1 Reply Last reply Reply Quote 0
      • apollon77
        apollon77 last edited by

        Von nodejs 🙂

        Der Code in "try" wird ausgeführt. Wenn dort eine Exception auftritt dann wird nicht, wie sonst, der weitere Ablauf im Programm abgebrochen sondern der Code im "catch"-Block ausgeführt. "e" ist dann ein Exception-Objekt w Du Details zur aufgetretenen Exception herausbekommen kannst, wenn relevant.

        W 1 Reply Last reply Reply Quote 0
        • ruhr70
          ruhr70 last edited by

          Super! Danke für die Antwort 😄

          Das verstehe sogar ich.

          1 Reply Last reply Reply Quote 0
          • W
            wiggerl @apollon77 last edited by

            @apollon77 muss ich e nicht deklarieren/definieren?
            Ich bekomme in der aktuellen Version von JavaScript einen "Fehler" mit red curly lines angezeigt

            apollon77 1 Reply Last reply Reply Quote 0
            • apollon77
              apollon77 @wiggerl last edited by

              @wiggerl nein das "e" wird von nodejs gefüllt mit der exception

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              Support us

              ioBroker
              Community Adapters
              Donate

              404
              Online

              31.9k
              Users

              80.2k
              Topics

              1.3m
              Posts

              3
              5
              781
              Loading More Posts
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes
              Reply
              • Reply as topic
              Log in to reply
              Community
              Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
              The ioBroker Community 2014-2023
              logo