errlens 1.0.10 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/index.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  const { Command } = require("commander");
4
4
  const { spawn } = require("child_process");
5
- const chalk = require("chalk");
6
5
  const path = require("path");
7
6
  const { findError } = require("../lib/matcher");
8
7
  const { formatError } = require("../lib/formatter");
@@ -20,9 +19,12 @@ program
20
19
  program
21
20
  .command("run <file>")
22
21
  .description("Run a Javascript file and analyze crashes")
23
- .action(async (file) => {
24
- const { default: ora } = await import("ora");
22
+ .option("--lang <code>", "output language (e.g. hi, es, fr)", "en")
25
23
 
24
+ .action(async (file,options) => {
25
+ const { default: ora } = await import("ora");
26
+ const { default: chalk } = await import("chalk");
27
+
26
28
  const isJson = Boolean(program.opts().json);
27
29
  const filePath = path.resolve(process.cwd(), file);
28
30
  const spinner = isJson
@@ -58,7 +60,7 @@ program
58
60
  spinner.stop();
59
61
  }
60
62
 
61
- const { count, matches } = findError(errorOutput);
63
+ const { count, matches } = findError(errorOutput,options.lang);
62
64
 
63
65
  // Process killed by signal
64
66
  if (code === null) {
@@ -107,6 +109,7 @@ program
107
109
  if (isJson) {
108
110
  console.log(JSON.stringify(result, null, 2));
109
111
  } else {
112
+ if (spinner) spinner.stop();
110
113
  console.log(chalk.red(`System Error: ${err.message}`));
111
114
  }
112
115
 
@@ -115,35 +118,32 @@ program
115
118
  });
116
119
 
117
120
  // ----------------- ANALYZE COMMAND -----------------
118
- program
121
+ program
119
122
  .command("analyze <errorString>")
120
123
  .description("Analyze a specific error string")
121
- .action((errorString) => {
124
+ .option("--lang <code>", "output language (e.g. hi, es, fr)", "en")
125
+ .action(async (errorString, options) => {
126
+ const { default: chalk } = await import("chalk");
122
127
  const isJson = Boolean(program.opts().json);
123
- const { count, matches } = findError(errorString);
128
+ const { count, matches } = findError(errorString, options.lang);
124
129
  const exitCode = count > 0 ? 1 : 0;
125
130
 
126
131
  if (isJson) {
127
- console.log(
128
- JSON.stringify({ code: exitCode, count, matches }, null, 2)
129
- );
132
+ console.log(JSON.stringify({ code: exitCode, count, matches }, null, 2));
130
133
  process.exit(exitCode);
131
134
  }
132
135
 
133
136
  if (count > 0) {
134
- console.log(
135
- chalk.bold.cyan(`\nšŸš€ ErrLens Analysis (${count} Issue(s)):`)
136
- );
137
+ console.log(chalk.bold.cyan(`\nšŸš€ ErrLens Analysis (${count} Issue(s)):`));
137
138
  matches.forEach((m) => console.log(formatError(m)));
138
139
  } else {
139
- console.log(
140
- chalk.red.bold("\nāŒ Crash detected (No known fix in database):")
141
- );
140
+ console.log(chalk.red.bold("\nāŒ Crash detected (No known fix in database):"));
142
141
  console.log(chalk.gray(errorString));
143
142
  }
144
143
 
145
144
  process.exit(exitCode);
146
145
  });
146
+
147
147
 
148
148
  // ----------------- PARSE -----------------
149
149
  program.parse(process.argv);
package/lib/formatter.js CHANGED
@@ -1,4 +1,5 @@
1
- const chalk = require("chalk");
1
+ const chalkImport = require("chalk");
2
+ const chalk = chalkImport.default || chalkImport;
2
3
  const boxen = require("boxen");
3
4
 
4
5
  function formatError(error) {
package/lib/injector.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const { findError } = require("./matcher");
2
2
  const { formatError } = require("./formatter");
3
- const chalk = require("chalk");
3
+ const chalkImport = require("chalk");
4
+ const chalk = chalkImport.default || chalkImport;
4
5
 
5
6
  /**
6
7
  * ERR_LENS INJECTOR
package/lib/matcher.js CHANGED
@@ -1,13 +1,62 @@
1
1
  const database = require("./database.json");
2
+ const fs = require('fs')
3
+ const path = require("path");
2
4
 
3
- function findError(input) {
5
+ // Loading the locale file
6
+ function loadLocale(lang = "en"){
7
+ const localesDir = path.resolve(__dirname, "../locales");
8
+ const normalizedLang =
9
+ typeof lang === "string" && /^[a-zA-Z0-9_-]+$/.test(lang)
10
+ ? lang
11
+ : "en";
12
+ const filepath = path.resolve(localesDir, `${normalizedLang}.json`);
13
+ const fallback = path.resolve(localesDir, "en.json");
14
+ const relativeToLocales = path.relative(localesDir, filepath);
15
+ const safeFilepath =
16
+ !relativeToLocales.startsWith("..") && !path.isAbsolute(relativeToLocales)
17
+ ? filepath
18
+ : fallback;
19
+
20
+ try {
21
+ return JSON.parse(fs.readFileSync(safeFilepath,"utf8"))
22
+ } catch (primaryError) {
23
+ try {
24
+ return JSON.parse(fs.readFileSync(fallback,"utf8"))
25
+ } catch (fallbackError) {
26
+ throw new Error(
27
+ `Failed to load locale \"${normalizedLang}\" at \"${safeFilepath}\" and fallback \"${fallback}\". Primary error: ${primaryError.message}. Fallback error: ${fallbackError.message}`
28
+ )
29
+ }
30
+ }
31
+ }
32
+
33
+ //this function will translate every single entry using the loaded locals
34
+ function translateEntry(entry,locale){
35
+ const key = entry.match
36
+ return{
37
+ ...entry,
38
+ explanation:locale[`${key}__explanation`] || entry.explanation,
39
+ why: locale[`${key}__why`] || entry.why,
40
+ fixes: (Array.isArray(entry.fixes) ? entry.fixes : []).map(
41
+ (fix,i) =>locale[`${key}__fix_${i}`] || fix
42
+ )
43
+ }
44
+ }
45
+
46
+
47
+ function findError(input,lang = "en") {
48
+
4
49
  if (!input) return { count: 0, matches: [] };
5
50
 
6
51
  if (typeof input !== "string") input = String(input);
7
52
 
8
53
  // 1. Normalize the input (Lowercase and remove extra whitespace)
9
54
  const lowerInput = input.toLowerCase();
10
-
55
+
56
+
57
+ const locale = loadLocale(lang) // I'm calling the load local file here
58
+
59
+ //untouched
11
60
  // 2. Filter the database
12
61
  let foundMatches = database.filter(entry => {
13
62
  const matchPhrase = entry.match.toLowerCase();
@@ -28,7 +77,7 @@ function findError(input) {
28
77
 
29
78
  for (const match of foundMatches) {
30
79
  if (!seenNames.has(match.name)) {
31
- uniqueMatches.push(match);
80
+ uniqueMatches.push(translateEntry(match,locale));
32
81
  seenNames.add(match.name);
33
82
  }
34
83
  }
@@ -0,0 +1,199 @@
1
+ {
2
+ "Cannot read properties of undefined__explanation": "Sie versuchen, auf eine Eigenschaft einer Variable zuzugreifen, die derzeit leer ist.",
3
+ "Cannot read properties of undefined__why": "Die Variable wurde nicht initialisiert oder ein API-Aufruf ist noch nicht abgeschlossen.",
4
+ "Cannot read properties of undefined__fix_0": "Verwenden Sie Optional Chaining: user?.name",
5
+ "Cannot read properties of undefined__fix_1": "Setzen Sie einen Standardwert: data || []",
6
+ "is not defined__explanation": "Sie verwenden eine Variable, die nicht deklariert wurde.",
7
+ "is not defined__why": "Tippfehler im Namen oder die Variable ist innerhalb einer anderen Funktion gekapselt.",
8
+ "is not defined__fix_0": "Auf Tippfehler prüfen",
9
+ "is not defined__fix_1": "Mit const/let deklarieren",
10
+ "is not a function__explanation": "Sie haben eine Variable als Funktion aufgerufen, aber es ist ein anderer Typ (String/Object).",
11
+ "is not a function__why": "Import fehlgeschlagen oder ein Callback wurde nicht korrekt übergeben.",
12
+ "is not a function__fix_0": "Imports überprüfen",
13
+ "is not a function__fix_1": "Typ mit typeof verifizieren",
14
+ "Cannot find module__explanation": "Node.js kann die Datei oder das Paket, das Sie importieren, nicht finden.",
15
+ "Cannot find module__why": "Das Paket ist nicht installiert oder der relative Pfad ist falsch.",
16
+ "Cannot find module__fix_0": "Führen Sie 'npm install' aus",
17
+ "Cannot find module__fix_1": "Dateipfad-Schreibweise überprüfen",
18
+ "EADDRINUSE__explanation": "Der Port, den Ihr Server verwenden mƶchte, wird bereits verwendet.",
19
+ "EADDRINUSE__why": "Eine andere Instanz Ihrer Anwendung lƤuft bereits.",
20
+ "EADDRINUSE__fix_0": "Den anderen Prozess beenden",
21
+ "EADDRINUSE__fix_1": "Die Portnummer Ƥndern",
22
+ "Maximum call stack size exceeded__explanation": "Die Aufrufstapel-Grenze wurde aufgrund übermäßiger Rekursion oder einer sehr tiefen Aufrufkette erreicht.",
23
+ "Maximum call stack size exceeded__why": "Eine rekursive Funktion ruft sich zu oft selbst auf, ohne einen Basisfall zu erreichen, oder eine Kette von Funktionsaufrufen baut sich zu tief auf.",
24
+ "Maximum call stack size exceeded__fix_0": "Rekursions-Abbruchbedingungen prüfen",
25
+ "Maximum call stack size exceeded__fix_1": "Verifizieren, dass rekursive BasisfƤlle erreichbar sind",
26
+ "Maximum call stack size exceeded__fix_2": "Aufrufketten-Tiefe und stapelbildende Schleifen überprüfen",
27
+ "ECONNREFUSED__explanation": "Ihre App hat versucht, sich mit einer Datenbank/API zu verbinden, wurde aber abgelehnt.",
28
+ "ECONNREFUSED__why": "Der Zielserver ist nicht erreichbar oder die URL ist falsch.",
29
+ "ECONNREFUSED__fix_0": "Stellen Sie sicher, dass die Datenbank lƤuft",
30
+ "ECONNREFUSED__fix_1": "Überprüfen Sie die API-URL",
31
+ "Assignment to constant variable__explanation": "Sie haben versucht, eine 'const'-Variable zu Ƥndern.",
32
+ "Assignment to constant variable__why": "Const-Variablen kƶnnen nicht neu zugewiesen werden.",
33
+ "Assignment to constant variable__fix_0": "Verwenden Sie 'let' anstelle von 'const'",
34
+ "ENOENT__explanation": "Sie versuchen, eine Datei zu lesen, die nicht existiert.",
35
+ "ENOENT__why": "Die Datei wurde verschoben oder der Pfad-String ist falsch.",
36
+ "ENOENT__fix_0": "Überprüfen Sie, ob die Datei existiert",
37
+ "ENOENT__fix_1": "Verwenden Sie path.join()",
38
+ "await is only valid in async functions__explanation": "Sie haben 'await' innerhalb einer normalen Funktion verwendet.",
39
+ "await is only valid in async functions__why": "Await erfordert das Schlüsselwort 'async' bei der übergeordneten Funktion.",
40
+ "await is only valid in async functions__fix_0": "Fügen Sie 'async' zur Funktionsdefinition hinzu",
41
+ "ERR_HTTP_HEADERS_SENT__explanation": "Sie haben eine Antwort gesendet, nachdem bereits eine gesendet wurde.",
42
+ "ERR_HTTP_HEADERS_SENT__why": "Mehrere res.send()-Aufrufe in einer Route.",
43
+ "ERR_HTTP_HEADERS_SENT__fix_0": "Verwenden Sie 'return res.send()', um die Ausführung zu stoppen",
44
+ "buffering timed out__explanation": "Mongoose konnte sich nicht rechtzeitig mit MongoDB verbinden.",
45
+ "buffering timed out__why": "Die Datenbank ist offline oder die Verbindungszeichenkette ist falsch.",
46
+ "buffering timed out__fix_0": "Überprüfen Sie den MongoDB-Status",
47
+ "buffering timed out__fix_1": "Überprüfen Sie die Verbindungszeichenkette",
48
+ "jwt malformed__explanation": "Der bereitgestellte Token hat keine gültige JWT-Struktur.",
49
+ "jwt malformed__why": "Der Token ist beschƤdigt oder es wurde nur ein Teil davon gesendet.",
50
+ "jwt malformed__fix_0": "Überprüfen Sie den 'Authorization'-Header",
51
+ "jwt malformed__fix_1": "Überprüfen Sie die Token-Generierung",
52
+ "secretOrPrivateKey must have a value__explanation": "JWT-Geheimschlüssel fehlt.",
53
+ "secretOrPrivateKey must have a value__why": "Umgebungsvariable (JWT_SECRET) ist nicht geladen.",
54
+ "secretOrPrivateKey must have a value__fix_0": ".env-Datei prüfen",
55
+ "secretOrPrivateKey must have a value__fix_1": "dotenv.config() ausführen",
56
+ "E11000__explanation": "Sie versuchen, Daten mit einem 'unique'-Feld zu speichern, das bereits existiert.",
57
+ "E11000__why": "Meist eine doppelte E-Mail oder Benutzername in der DB.",
58
+ "E11000__fix_0": "Prüfen, ob Daten existieren, bevor gespeichert wird",
59
+ "E11000__fix_1": "Eindeutige Fehlerbehandlung verwenden",
60
+ "Unexpected token < in JSON__explanation": "Sie haben versucht, JSON zu parsen, aber stattdessen HTML erhalten.",
61
+ "Unexpected token < in JSON__why": "Ihre API hat eine Fehlerseite (HTML) statt Daten (JSON) zurückgegeben.",
62
+ "Unexpected token < in JSON__fix_0": "API-URL prüfen",
63
+ "Unexpected token < in JSON__fix_1": "Server-Logs auf Abstürze prüfen",
64
+ "CORS__explanation": "Browser hat Ihre Anfrage aus Sicherheitsgründen blockiert.",
65
+ "CORS__why": "Der Server erlaubt keine Anfragen von Ihrer Frontend-Domain.",
66
+ "CORS__fix_0": "'cors'-Paket auf dem Server installieren",
67
+ "CORS__fix_1": "app.use(cors())",
68
+ "'map' of undefined__explanation": "Sie versuchen, durch ein Array zu iterieren, das nicht existiert.",
69
+ "'map' of undefined__why": "Die Variable ist null/undefined statt einem Array.",
70
+ "'map' of undefined__fix_0": "Als leeres Array initialisieren: data || []",
71
+ "'map' of undefined__fix_1": "API-Antwort prüfen",
72
+ "module not found 'dotenv'__explanation": "Das 'dotenv'-Paket fehlt.",
73
+ "module not found 'dotenv'__why": "Sie haben es im Code verwendet, aber nicht installiert.",
74
+ "module not found 'dotenv'__fix_0": "npm install dotenv",
75
+ "validation failed__explanation": "Daten stimmen nicht mit Ihrem Mongoose-Schema überein.",
76
+ "validation failed__why": "Pflichtfelder fehlen oder falsche Datentypen.",
77
+ "validation failed__fix_0": "Pflichtfelder überprüfen",
78
+ "validation failed__fix_1": "Daten im Frontend validieren",
79
+ "not authorized__explanation": "Zugriff verweigert aufgrund fehlender oder ungültiger Anmeldedaten.",
80
+ "not authorized__why": "Token abgelaufen oder falscher API-Schlüssel.",
81
+ "not authorized__fix_0": "Erneut anmelden",
82
+ "not authorized__fix_1": "Header überprüfen",
83
+ "status code 404__explanation": "Der API-Endpunkt, den Sie aufrufen, existiert nicht.",
84
+ "status code 404__why": "Falsche URL oder die Server-Route ist nicht definiert.",
85
+ "status code 404__fix_0": "Schreibweise der API-Route überprüfen",
86
+ "status code 404__fix_1": "Basis-URL überprüfen",
87
+ "status code 500__explanation": "Der Server ist beim Verarbeiten Ihrer Anfrage abgestürzt.",
88
+ "status code 500__why": "Ein Fehler im Backend-Server-Code.",
89
+ "status code 500__fix_0": "Server-Konsolenprotokolle überprüfen",
90
+ "status code 500__fix_1": "Try/Catch auf dem Server hinzufügen",
91
+ "is not iterable__explanation": "Sie haben eine for...of-Schleife oder Spread (...) auf einem Nicht-Array verwendet.",
92
+ "is not iterable__why": "Sie haben versucht, über ein Objekt oder Null zu iterieren.",
93
+ "is not iterable__fix_0": "Sicherstellen, dass die Variable ein Array ist",
94
+ "is not iterable__fix_1": "Object.keys() verwenden",
95
+ "require is not defined__explanation": "Sie verwenden 'require' in einem ES-Modul.",
96
+ "require is not defined__why": "Node.js ist in package.json auf 'type': 'module' eingestellt.",
97
+ "require is not defined__fix_0": "Stattdessen 'import' verwenden",
98
+ "require is not defined__fix_1": "'type: module' entfernen",
99
+ "EACCES__explanation": "Sie haben keine Berechtigung, auf diese Datei/diesen Port zuzugreifen.",
100
+ "EACCES__why": "Sie benƶtigen Administratorrechte oder die Datei ist gesperrt.",
101
+ "EACCES__fix_0": "'sudo' verwenden (Linux/Mac)",
102
+ "EACCES__fix_1": "Dateiberechtigungen überprüfen",
103
+ "has already been declared__explanation": "Sie haben denselben Variablennamen zweimal deklariert.",
104
+ "has already been declared__why": "Verwendung von 'let' oder 'const' für einen Namen, der bereits im selben Gültigkeitsbereich existiert.",
105
+ "has already been declared__fix_0": "Eine der Variablen umbenennen",
106
+ "has already been declared__fix_1": "Die zweite Deklaration entfernen",
107
+ "PayloadTooLargeError__explanation": "Die von Ihnen gesendeten Daten sind zu groß für den Server.",
108
+ "PayloadTooLargeError__why": "Normalerweise ein Bild oder eine Datei, die das Body-Parser-Limit überschreitet.",
109
+ "PayloadTooLargeError__fix_0": "Limit erhƶhen: app.use(express.json({limit: '50mb'}))",
110
+ "set property of null__explanation": "Sie versuchen, einer Eigenschaft einer leeren Variable einen Wert zuzuweisen.",
111
+ "set property of null__why": "Das Objekt, das Sie Ƥndern mƶchten, wurde noch nicht erstellt.",
112
+ "set property of null__fix_0": "Das Objekt zuerst initialisieren",
113
+ "set property of null__fix_1": "Auf null prüfen",
114
+ "socket hang up__explanation": "Der Server hat die Verbindung unerwartet geschlossen.",
115
+ "socket hang up__why": "Server abgestürzt oder Zeitüberschreitung aufgetreten.",
116
+ "socket hang up__fix_0": "Server-Status überprüfen",
117
+ "socket hang up__fix_1": "Zeitlimit erhƶhen",
118
+ "Unexpected end of JSON input__explanation": "Die JSON-Daten sind unvollstƤndig oder leer.",
119
+ "Unexpected end of JSON input__why": "Der Server hat eine leere Zeichenfolge anstelle von JSON gesendet.",
120
+ "Unexpected end of JSON input__fix_0": "API-Antwort überprüfen",
121
+ "Unexpected end of JSON input__fix_1": "Leere Antworten behandeln",
122
+ "Script execution timed out__explanation": "Ihr Code hat zu lange für die Ausführung gebraucht.",
123
+ "Script execution timed out__why": "AufwƤndige Berechnung oder Endlosschleife.",
124
+ "Script execution timed out__fix_0": "Logik optimieren",
125
+ "Script execution timed out__fix_1": "Worker-Threads verwenden",
126
+ "'then' of undefined__explanation": "Sie haben .then() auf etwas aufgerufen, das kein Promise ist.",
127
+ "'then' of undefined__why": "Die Funktion hat kein Promise zurückgegeben.",
128
+ "'then' of undefined__fix_0": "Funktion 'async' machen",
129
+ "'then' of undefined__fix_1": "Promise zurückgeben",
130
+ "Invalid connection string__explanation": "Das Format der Datenbank-URL ist falsch.",
131
+ "Invalid connection string__why": "Fehlende Symbole wie '@' oder '/' in der URI.",
132
+ "Invalid connection string__fix_0": "DB-URI-Format prüfen",
133
+ "window is not defined__explanation": "Sie versuchen, Browser-Code (window) in Node.js zu verwenden.",
134
+ "window is not defined__why": "Node.js hat kein 'window'-Objekt (das ist für Browser).",
135
+ "window is not defined__fix_0": "Prüfen, ob im Browser ausgeführt",
136
+ "window is not defined__fix_1": "Stattdessen 'global' verwenden",
137
+ "Too many listeners__explanation": "Speicherleck bei EventEmitters erkannt.",
138
+ "Too many listeners__why": "Event-Listener werden innerhalb einer Schleife oder wiederholten Funktion hinzugefügt.",
139
+ "Too many listeners__fix_0": ".once() statt .on() verwenden",
140
+ "Too many listeners__fix_1": "Alte Listener entfernen",
141
+ "spread non-iterable__explanation": "Sie haben versucht, `...obj` zu verwenden, wo es nicht erlaubt ist.",
142
+ "spread non-iterable__why": "Versuch, ein Objekt in ein Array zu spreaden.",
143
+ "spread non-iterable__fix_0": "Eckige Klammern [] für Arrays und {} für Objekte verwenden",
144
+ "EPIPE__explanation": "Broken Pipe: Daten werden an eine geschlossene Verbindung gesendet.",
145
+ "EPIPE__why": "Die Gegenseite (Client/Prozess) hƶrt nicht mehr zu.",
146
+ "EPIPE__fix_0": "Stream-Fehler behandeln",
147
+ "EPIPE__fix_1": "Prüfen, ob Prozess aktiv ist",
148
+ "Missing initializer__explanation": "Sie haben eine Konstante ohne Wertzuweisung deklariert.",
149
+ "Missing initializer__why": "Const muss sofort bei der Erstellung gesetzt werden.",
150
+ "Missing initializer__fix_0": "Wert zuweisen: const x = 1;",
151
+ "peerinvalid__explanation": "Installierte Pakete haben widersprüchliche Versionen.",
152
+ "peerinvalid__why": "Eine Bibliothek benƶtigt Version A, eine andere benƶtigt Version B.",
153
+ "peerinvalid__fix_0": "npm install --legacy-peer-deps",
154
+ "filter is not a function__explanation": "Sie versuchen, etwas zu filtern, das kein Array ist.",
155
+ "filter is not a function__why": "Die Variable ist ein Objekt oder Null.",
156
+ "filter is not a function__fix_0": "Stellen Sie sicher, dass data ein Array ist: Array.isArray(data)",
157
+ "ENOTFOUND__explanation": "DNS-Auflösung für die URL fehlgeschlagen.",
158
+ "ENOTFOUND__why": "Tippfehler in der URL oder keine Internetverbindung.",
159
+ "ENOTFOUND__fix_0": "URL-Schreibweise überprüfen",
160
+ "ENOTFOUND__fix_1": "DNS/Internet überprüfen",
161
+ "reserved word__explanation": "Sie haben ein für JS reserviertes Wort (wie 'class' oder 'await') als Variablennamen verwendet.",
162
+ "reserved word__why": "Sie kƶnnen eine Variable nicht 'class' oder 'function' nennen.",
163
+ "reserved word__fix_0": "Variable umbenennen",
164
+ "Cannot find name__explanation": "TypeScript kann diese Variable oder diesen Typ nicht finden.",
165
+ "Cannot find name__why": "Variable nicht deklariert oder @types-Paket fehlt.",
166
+ "Cannot find name__fix_0": "Imports überprüfen",
167
+ "Cannot find name__fix_1": "Typen installieren: npm install @types/node",
168
+ "convert undefined or null to object__explanation": "Object-Methoden werden auf eine leere Variable angewendet.",
169
+ "convert undefined or null to object__why": "Object.keys(data) wird verwendet, wenn data null ist.",
170
+ "convert undefined or null to object__fix_0": "Überprüfen Sie, ob data existiert: data && Object.keys(data)",
171
+ "Access-Control-Allow-Origin__explanation": "CORS-Fehler: Der Server teilt keine Daten mit Ihrer Domain.",
172
+ "Access-Control-Allow-Origin__why": "Sicherheitsrichtlinie im Backend.",
173
+ "Access-Control-Allow-Origin__fix_0": "CORS serverseitig aktivieren",
174
+ "Invalid or unexpected token__explanation": "Es befindet sich ein Zeichen in Ihrem Code, das dort nicht sein sollte.",
175
+ "Invalid or unexpected token__why": "Beim Kopieren und Einfügen werden versteckte Symbole übertragen oder typografische Anführungszeichen (ā€ž statt \") verwendet.",
176
+ "Invalid or unexpected token__fix_0": "Zeile manuell neu eingeben",
177
+ "Invalid or unexpected token__fix_1": "Prüfe auf unsichtbare Zeichen",
178
+ "timeout of 2000ms exceeded__explanation": "Dein Test hat zu lange gebraucht, um abzuschließen.",
179
+ "timeout of 2000ms exceeded__why": "Asynchroner Code hat 'done()' nicht aufgerufen oder wurde nicht rechtzeitig beendet.",
180
+ "timeout of 2000ms exceeded__fix_0": "Erhƶhe das Test-Timeout",
181
+ "timeout of 2000ms exceeded__fix_1": "Prüfe auf langsame API-Aufrufe",
182
+ "does not exist on type__explanation": "TypeScript-Fehler: Zugriff auf eine Eigenschaft, die nicht im Interface vorhanden ist.",
183
+ "does not exist on type__why": "Die Objektstruktur stimmt nicht mit der TypeScript-Typdefinition überein.",
184
+ "does not exist on type__fix_0": "Aktualisiere das Interface",
185
+ "does not exist on type__fix_1": "Verwende Type Casting: (obj as any).prop",
186
+ "npm ERR! 404__explanation": "NPM kann das Paket, das du installieren mƶchtest, nicht finden.",
187
+ "npm ERR! 404__why": "Tippfehler im Paketnamen oder es ist ein privates Paket.",
188
+ "npm ERR! 404__fix_0": "Prüfe die Schreibweise des Pakets",
189
+ "npm ERR! 404__fix_1": "npm login",
190
+ "Unexpected end of input__explanation": "Ihr Code wurde abrupt beendet, wahrscheinlich fehlt eine schließende Klammer.",
191
+ "Unexpected end of input__why": "Sie haben eine ( [ oder { geöffnet, aber vergessen, sie mit ) ] oder } zu schließen.",
192
+ "Unexpected end of input__fix_0": "Prüfen Sie auf fehlende schließende Klammern )",
193
+ "Unexpected end of input__fix_1": "Prüfen Sie auf fehlende geschweifte Klammern }",
194
+ "Unexpected end of input__fix_2": "Stelle sicher, dass alle Anführungszeichen ' oder \" geschlossen sind",
195
+ "missing ) after argument list__explanation": "Sie haben vergessen, einen Funktionsaufruf mit ')' zu schließen.",
196
+ "missing ) after argument list__why": "Eine Klammer wurde geƶffnet, aber die Zeile endete oder ein anderes Symbol erschien, bevor sie geschlossen wurde.",
197
+ "missing ) after argument list__fix_0": "Fügen Sie eine ')' am Ende Ihres Funktionsaufrufs hinzu",
198
+ "missing ) after argument list__fix_1": "Prüfen Sie, ob Sie versehentlich eine ')' beim Tippen gelöscht haben"
199
+ }
@@ -0,0 +1,199 @@
1
+ {
2
+ "Cannot read properties of undefined__explanation": "You are trying to access a property on a variable that is currently empty.",
3
+ "Cannot read properties of undefined__why": "The variable wasn't initialized, or an API call hasn't finished yet.",
4
+ "Cannot read properties of undefined__fix_0": "Use optional chaining: user?.name",
5
+ "Cannot read properties of undefined__fix_1": "Set a default value: data || []",
6
+ "is not defined__explanation": "You're using a variable that hasn't been declared.",
7
+ "is not defined__why": "Typo in the name or the variable is scoped inside another function.",
8
+ "is not defined__fix_0": "Check for typos",
9
+ "is not defined__fix_1": "Declare with const/let",
10
+ "is not a function__explanation": "You called a variable as a function, but it's another type (String/Object).",
11
+ "is not a function__why": "Import failed or a callback wasn't passed correctly.",
12
+ "is not a function__fix_0": "Check imports",
13
+ "is not a function__fix_1": "Verify type with typeof",
14
+ "Cannot find module__explanation": "Node.js cannot find the file or package you are importing.",
15
+ "Cannot find module__why": "The package isn't installed or the relative path is wrong.",
16
+ "Cannot find module__fix_0": "Run 'npm install'",
17
+ "Cannot find module__fix_1": "Check file path spelling",
18
+ "EADDRINUSE__explanation": "The port your server wants is already being used.",
19
+ "EADDRINUSE__why": "Another instance of your app is already running.",
20
+ "EADDRINUSE__fix_0": "Kill the other process",
21
+ "EADDRINUSE__fix_1": "Change the port number",
22
+ "Maximum call stack size exceeded__explanation": "The call stack limit was reached due to excessive recursion or a very deep call chain.",
23
+ "Maximum call stack size exceeded__why": "A recursive function is calling itself too many times without hitting a base case, or a chain of function calls builds up too deeply.",
24
+ "Maximum call stack size exceeded__fix_0": "Check recursion exit conditions",
25
+ "Maximum call stack size exceeded__fix_1": "Verify recursive base cases are reachable",
26
+ "Maximum call stack size exceeded__fix_2": "Check call-chain depth and stack-building loops",
27
+ "ECONNREFUSED__explanation": "Your app tried to connect to a database/API but was rejected.",
28
+ "ECONNREFUSED__why": "The target server is down or the URL is wrong.",
29
+ "ECONNREFUSED__fix_0": "Ensure DB is running",
30
+ "ECONNREFUSED__fix_1": "Check API URL",
31
+ "Assignment to constant variable__explanation": "You tried to change a 'const' variable.",
32
+ "Assignment to constant variable__why": "Const variables cannot be reassigned.",
33
+ "Assignment to constant variable__fix_0": "Use 'let' instead of 'const'",
34
+ "ENOENT__explanation": "You're trying to read a file that doesn't exist.",
35
+ "ENOENT__why": "File moved or path string is incorrect.",
36
+ "ENOENT__fix_0": "Verify file exists",
37
+ "ENOENT__fix_1": "Use path.join()",
38
+ "await is only valid in async functions__explanation": "You used 'await' inside a normal function.",
39
+ "await is only valid in async functions__why": "Await requires the 'async' keyword on the parent function.",
40
+ "await is only valid in async functions__fix_0": "Add 'async' to function definition",
41
+ "ERR_HTTP_HEADERS_SENT__explanation": "You sent a response after already sending one.",
42
+ "ERR_HTTP_HEADERS_SENT__why": "Multiple res.send() calls in one route.",
43
+ "ERR_HTTP_HEADERS_SENT__fix_0": "Use 'return res.send()' to stop execution",
44
+ "buffering timed out__explanation": "Mongoose couldn't connect to MongoDB in time.",
45
+ "buffering timed out__why": "Database is offline or connection string is wrong.",
46
+ "buffering timed out__fix_0": "Check MongoDB status",
47
+ "buffering timed out__fix_1": "Check connection string",
48
+ "jwt malformed__explanation": "The token provided is not a valid JWT structure.",
49
+ "jwt malformed__why": "Token is corrupted or only part of it was sent.",
50
+ "jwt malformed__fix_0": "Check 'Authorization' header",
51
+ "jwt malformed__fix_1": "Verify token generation",
52
+ "secretOrPrivateKey must have a value__explanation": "JWT secret key is missing.",
53
+ "secretOrPrivateKey must have a value__why": "Environment variable (JWT_SECRET) is not loaded.",
54
+ "secretOrPrivateKey must have a value__fix_0": "Check .env file",
55
+ "secretOrPrivateKey must have a value__fix_1": "Run dotenv.config()",
56
+ "E11000__explanation": "You're saving data with a 'unique' field that already exists.",
57
+ "E11000__why": "Usually a duplicate Email or Username in the DB.",
58
+ "E11000__fix_0": "Check if data exists before saving",
59
+ "E11000__fix_1": "Use unique error handling",
60
+ "Unexpected token < in JSON__explanation": "You tried to parse JSON, but got HTML instead.",
61
+ "Unexpected token < in JSON__why": "Your API returned an error page (HTML) instead of data (JSON).",
62
+ "Unexpected token < in JSON__fix_0": "Check the API URL",
63
+ "Unexpected token < in JSON__fix_1": "Check server logs for crashes",
64
+ "CORS__explanation": "Browser blocked your request for security reasons.",
65
+ "CORS__why": "The server doesn't allow requests from your frontend domain.",
66
+ "CORS__fix_0": "Install 'cors' package on server",
67
+ "CORS__fix_1": "app.use(cors())",
68
+ "'map' of undefined__explanation": "You're trying to loop through an array that doesn't exist.",
69
+ "'map' of undefined__why": "The variable is null/undefined instead of an Array.",
70
+ "'map' of undefined__fix_0": "Initialize as empty array: data || []",
71
+ "'map' of undefined__fix_1": "Check API response",
72
+ "module not found 'dotenv'__explanation": "The 'dotenv' package is missing.",
73
+ "module not found 'dotenv'__why": "You used it in code but didn't install it.",
74
+ "module not found 'dotenv'__fix_0": "npm install dotenv",
75
+ "validation failed__explanation": "Data doesn't match your Mongoose schema.",
76
+ "validation failed__why": "Missing required fields or wrong data types.",
77
+ "validation failed__fix_0": "Check required fields",
78
+ "validation failed__fix_1": "Validate data on frontend",
79
+ "not authorized__explanation": "Access denied because of missing or invalid credentials.",
80
+ "not authorized__why": "Token expired or wrong API key.",
81
+ "not authorized__fix_0": "Login again",
82
+ "not authorized__fix_1": "Check headers",
83
+ "status code 404__explanation": "The API endpoint you are calling doesn't exist.",
84
+ "status code 404__why": "Wrong URL or the server route isn't defined.",
85
+ "status code 404__fix_0": "Check API route spelling",
86
+ "status code 404__fix_1": "Check Base URL",
87
+ "status code 500__explanation": "The server crashed while processing your request.",
88
+ "status code 500__why": "A bug on the backend server code.",
89
+ "status code 500__fix_0": "Check server console logs",
90
+ "status code 500__fix_1": "Add try/catch on server",
91
+ "is not iterable__explanation": "You used a for...of loop or spread (...) on a non-array.",
92
+ "is not iterable__why": "You tried to iterate over an Object or Null.",
93
+ "is not iterable__fix_0": "Ensure variable is an Array",
94
+ "is not iterable__fix_1": "Use Object.keys()",
95
+ "require is not defined__explanation": "You're using 'require' in an ES Module.",
96
+ "require is not defined__why": "Node.js is set to 'type': 'module' in package.json.",
97
+ "require is not defined__fix_0": "Use 'import' instead",
98
+ "require is not defined__fix_1": "Remove 'type: module'",
99
+ "EACCES__explanation": "You don't have permission to access this file/port.",
100
+ "EACCES__why": "You need admin rights or the file is locked.",
101
+ "EACCES__fix_0": "Use 'sudo' (Linux/Mac)",
102
+ "EACCES__fix_1": "Check file permissions",
103
+ "has already been declared__explanation": "You declared the same variable name twice.",
104
+ "has already been declared__why": "Using 'let' or 'const' on a name that exists in the same scope.",
105
+ "has already been declared__fix_0": "Rename one of the variables",
106
+ "has already been declared__fix_1": "Remove the second declaration",
107
+ "PayloadTooLargeError__explanation": "The data you sent is too big for the server.",
108
+ "PayloadTooLargeError__why": "Usually an image or file that exceeds the body-parser limit.",
109
+ "PayloadTooLargeError__fix_0": "Increase limit: app.use(express.json({limit: '50mb'}))",
110
+ "set property of null__explanation": "You're trying to give a value to a property of an empty variable.",
111
+ "set property of null__why": "The object you're modifying hasn't been created yet.",
112
+ "set property of null__fix_0": "Initialize the object first",
113
+ "set property of null__fix_1": "Check for null",
114
+ "socket hang up__explanation": "The server closed the connection unexpectedly.",
115
+ "socket hang up__why": "Server crashed or timeout occurred.",
116
+ "socket hang up__fix_0": "Check server health",
117
+ "socket hang up__fix_1": "Increase timeout limit",
118
+ "Unexpected end of JSON input__explanation": "The JSON data is incomplete or empty.",
119
+ "Unexpected end of JSON input__why": "The server sent an empty string instead of JSON.",
120
+ "Unexpected end of JSON input__fix_0": "Check API response body",
121
+ "Unexpected end of JSON input__fix_1": "Handle empty responses",
122
+ "Script execution timed out__explanation": "Your code took too long to run.",
123
+ "Script execution timed out__why": "Heavy computation or infinite loop.",
124
+ "Script execution timed out__fix_0": "Optimize logic",
125
+ "Script execution timed out__fix_1": "Use worker threads",
126
+ "'then' of undefined__explanation": "You called .then() on something that isn't a Promise.",
127
+ "'then' of undefined__why": "The function didn't return a promise.",
128
+ "'then' of undefined__fix_0": "Make function 'async'",
129
+ "'then' of undefined__fix_1": "Return a Promise",
130
+ "Invalid connection string__explanation": "The database URL format is wrong.",
131
+ "Invalid connection string__why": "Missing symbols like '@' or '/' in the URI.",
132
+ "Invalid connection string__fix_0": "Check DB URI format",
133
+ "window is not defined__explanation": "You're trying to use browser code (window) in Node.js.",
134
+ "window is not defined__why": "Node.js doesn't have a 'window' object (that's for browsers).",
135
+ "window is not defined__fix_0": "Check if running in browser",
136
+ "window is not defined__fix_1": "Use 'global' instead",
137
+ "Too many listeners__explanation": "Memory leak detected in EventEmitters.",
138
+ "Too many listeners__why": "Adding event listeners inside a loop or repeated function.",
139
+ "Too many listeners__fix_0": "Use .once() instead of .on()",
140
+ "Too many listeners__fix_1": "Remove old listeners",
141
+ "spread non-iterable__explanation": "You tried to use `...obj` where it's not allowed.",
142
+ "spread non-iterable__why": "Trying to spread an object into an array.",
143
+ "spread non-iterable__fix_0": "Use brackets [] for arrays and {} for objects",
144
+ "EPIPE__explanation": "Broken pipe: sending data to a closed connection.",
145
+ "EPIPE__why": "The other side (client/process) stopped listening.",
146
+ "EPIPE__fix_0": "Handle stream errors",
147
+ "EPIPE__fix_1": "Check if process is alive",
148
+ "Missing initializer__explanation": "You declared a const without giving it a value.",
149
+ "Missing initializer__why": "Const must be set immediately when created.",
150
+ "Missing initializer__fix_0": "Assign a value: const x = 1;",
151
+ "peerinvalid__explanation": "Installed packages have conflicting versions.",
152
+ "peerinvalid__why": "One library needs version A, another needs version B.",
153
+ "peerinvalid__fix_0": "npm install --legacy-peer-deps",
154
+ "filter is not a function__explanation": "You're trying to filter something that isn't an array.",
155
+ "filter is not a function__why": "The variable is an Object or Null.",
156
+ "filter is not a function__fix_0": "Ensure data is an Array: Array.isArray(data)",
157
+ "ENOTFOUND__explanation": "DNS lookup failed for the URL.",
158
+ "ENOTFOUND__why": "Typo in the URL or no internet connection.",
159
+ "ENOTFOUND__fix_0": "Check URL spelling",
160
+ "ENOTFOUND__fix_1": "Check DNS/Internet",
161
+ "reserved word__explanation": "You used a word saved for JS (like 'class' or 'await') as a variable name.",
162
+ "reserved word__why": "You can't name a variable 'class' or 'function'.",
163
+ "reserved word__fix_0": "Rename the variable",
164
+ "Cannot find name__explanation": "TypeScript cannot find this variable or type.",
165
+ "Cannot find name__why": "Variable not declared or missing @types package.",
166
+ "Cannot find name__fix_0": "Check imports",
167
+ "Cannot find name__fix_1": "Install types: npm install @types/node",
168
+ "convert undefined or null to object__explanation": "Calling Object methods on an empty variable.",
169
+ "convert undefined or null to object__why": "Using Object.keys(data) when data is null.",
170
+ "convert undefined or null to object__fix_0": "Check if data exists: data && Object.keys(data)",
171
+ "Access-Control-Allow-Origin__explanation": "CORS error: Server isn't sharing data with your domain.",
172
+ "Access-Control-Allow-Origin__why": "Security policy on the backend.",
173
+ "Access-Control-Allow-Origin__fix_0": "Enable CORS on the server side",
174
+ "Invalid or unexpected token__explanation": "There is a character in your code that shouldn't be there.",
175
+ "Invalid or unexpected token__why": "Copy-pasting hidden symbols or using smart quotes (ā€ instead of \").",
176
+ "Invalid or unexpected token__fix_0": "Retype the line manually",
177
+ "Invalid or unexpected token__fix_1": "Check for invisible symbols",
178
+ "timeout of 2000ms exceeded__explanation": "Your test took too long to finish.",
179
+ "timeout of 2000ms exceeded__why": "Asynchronous code didn't call 'done()' or finish in time.",
180
+ "timeout of 2000ms exceeded__fix_0": "Increase test timeout",
181
+ "timeout of 2000ms exceeded__fix_1": "Check for slow API calls",
182
+ "does not exist on type__explanation": "TypeScript Error: Accessing a property that isn't in the Interface.",
183
+ "does not exist on type__why": "The object structure doesn't match the TS Type definition.",
184
+ "does not exist on type__fix_0": "Update the Interface",
185
+ "does not exist on type__fix_1": "Use type casting: (obj as any).prop",
186
+ "npm ERR! 404__explanation": "NPM can't find the package you want to install.",
187
+ "npm ERR! 404__why": "Typo in the package name or it's a private package.",
188
+ "npm ERR! 404__fix_0": "Check package spelling",
189
+ "npm ERR! 404__fix_1": "npm login",
190
+ "Unexpected end of input__explanation": "Your code stopped abruptly, likely due to a missing closing bracket.",
191
+ "Unexpected end of input__why": "You opened a ( [ or { but forgot to close it with ) ] or }.",
192
+ "Unexpected end of input__fix_0": "Check for missing closing parentheses )",
193
+ "Unexpected end of input__fix_1": "Check for missing curly braces }",
194
+ "Unexpected end of input__fix_2": "Ensure all quotes ' or \" are closed",
195
+ "missing ) after argument list__explanation": "You forgot to close a function call with a ')'.",
196
+ "missing ) after argument list__why": "A parenthesis was opened but the line ended or another symbol appeared before it was closed.",
197
+ "missing ) after argument list__fix_0": "Add a ')' at the end of your function call",
198
+ "missing ) after argument list__fix_1": "Check if you accidentally deleted a ')' while typing"
199
+ }