diff --git a/playground/errors.html b/playground/errors.html new file mode 100644 index 00000000..503c0515 --- /dev/null +++ b/playground/errors.html @@ -0,0 +1,303 @@ + + + + + + tsb — pd.errors + + + + +
+
+
Initializing playground…
+
+ + ← Back to roadmap +

pd.errors

+

Pandas-compatible error and warning classes — mirrors Python's pd.errors module. + All classes extend native Error and integrate with try/catch and instanceof.

+ +
+

1 — Base classes: ValueError, KeyError, IndexError

+

Three base classes mirror Python's built-in exceptions. They extend native JS error types so they + work with standard error-handling idioms.

+
+
+ TypeScript +
+ + +
+
+ +
Click ▶ Run to execute
+
Ctrl+Enter to run · Tab to indent
+
+
+ +
+

2 — Catching specific errors with instanceof

+

Use instanceof in catch blocks to handle specific error types — just like Python's + except SpecificError.

+
+
+ TypeScript +
+ + +
+
+ +
Click ▶ Run to execute
+
Ctrl+Enter to run · Tab to indent
+
+
+ +
+

3 — The errors namespace (pd.errors style)

+

All error classes are grouped under the errors namespace, mirroring + Python's pd.errors.ParserError etc.

+
+
+ TypeScript +
+ + +
+
+ +
Click ▶ Run to execute
+
Ctrl+Enter to run · Tab to indent
+
+
+ +
+

4 — AbstractMethodError for extension classes

+

AbstractMethodError is thrown when a subclass forgets to implement a required method — + mirroring Python's raise NotImplementedError.

+
+
+ TypeScript +
+ + +
+
+ +
Click ▶ Run to execute
+
Ctrl+Enter to run · Tab to indent
+
+
+ + + + + + diff --git a/src/core/align.ts b/src/core/align.ts index 144f53b5..ebda596e 100644 --- a/src/core/align.ts +++ b/src/core/align.ts @@ -92,6 +92,8 @@ function resolveIndex(left: Index