Bump version to 1.0.2 in package.json, add error logging for cookie loading in Config class, and log CookieJar content in registrieren function

This commit is contained in:
Björn Pöttker 2025-08-30 11:18:52 +02:00
parent 2bc5c2cce6
commit 1c81633b4c
3 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "agrarmonitorlib", "name": "agrarmonitorlib",
"version": "1.0.1", "version": "1.0.2",
"description": "Node.js library for Agrarmonitor", "description": "Node.js library for Agrarmonitor",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {

View File

@ -27,6 +27,7 @@ class Config {
return CookieJar.fromJSON(data); return CookieJar.fromJSON(data);
} }
} catch (e) { } catch (e) {
console.log("fehler beim laden der cookies:", e)
// Fehler beim Laden, leere Jar zurückgeben // Fehler beim Laden, leere Jar zurückgeben
} }
return new CookieJar(); return new CookieJar();

View File

@ -13,6 +13,9 @@ const { JSDOM } = require('jsdom');
async function registrieren(config, agrarmonitorId, pcName) { async function registrieren(config, agrarmonitorId, pcName) {
const cookieJar = config.cookieJar; const cookieJar = config.cookieJar;
// Cookie-Jar Inhalt loggen
console.log('🍪 CookieJar Inhalt:', JSON.stringify(cookieJar.toJSON(), null, 2));
try { try {
if (!agrarmonitorId || !pcName) { if (!agrarmonitorId || !pcName) {
console.error('❌ AgrarmonitorID oder PC-Name fehlt'); console.error('❌ AgrarmonitorID oder PC-Name fehlt');