Error handling.

This commit is contained in:
2025-11-24 01:59:54 +01:00
parent 2f20998f22
commit d0fc94f0c0
14 changed files with 391 additions and 21 deletions
+24
View File
@@ -19,6 +19,7 @@ SOURCES = $(SRC_DIR)/main.c \
$(SRC_DIR)/string_utils.c \
$(SRC_DIR)/preprocessor.c \
$(SRC_DIR)/oop.c \
$(SRC_DIR)/error.c \
$(SRC_DIR)/stdlib/stdlib.c \
$(SRC_DIR)/stdlib/string/string_stdlib.c \
$(SRC_DIR)/stdlib/math/math_stdlib.c \
@@ -136,6 +137,20 @@ test-eval: $(TARGET)
test-validation: $(TARGET)
$(TARGET) $(TEST_DIR)/test_input_validation.rc
demo-error-stacktrace: $(TARGET)
@echo "=== Demonstrating Full Stack Trace ==="
-$(TARGET) $(TEST_DIR)/test_error_stacktrace.rc
demo-error-undefined: $(TARGET)
@echo "=== Demonstrating Undefined Variable Error ==="
-$(TARGET) $(TEST_DIR)/test_error_undefined_var.rc
demo-error-native: $(TARGET)
@echo "=== Demonstrating Error in Native Function Call ==="
-$(TARGET) $(TEST_DIR)/test_error_native.rc
demo-errors: demo-error-stacktrace demo-error-undefined demo-error-native
run-http-simple: $(TARGET)
$(TARGET) $(EXAMPLE_DIR)/http_simple.rc
@@ -165,6 +180,14 @@ help:
@echo " make test-async - Async stdlib (20+ tests)"
@echo " make test-oop - OOP features (31 tests)"
@echo " make test-preprocessor - Preprocessor (2 tests)"
@echo " make test-eval - Eval function (30 tests)"
@echo " make test-validation - Input validation (77 tests)"
@echo ""
@echo "Error Handling Demonstrations:"
@echo " make demo-errors - Run all error handling demos"
@echo " make demo-error-stacktrace - Show full stack trace with file:line"
@echo " make demo-error-undefined - Show undefined variable error with tips"
@echo " make demo-error-native - Show error during native function call"
@echo ""
@echo "Examples:"
@echo " make run-http-simple - Run http_simple.rc (single connection HTTP server)"
@@ -178,6 +201,7 @@ help:
@echo " stdlib/math/ - Math functions"
@echo " stdlib/io/ - I/O functions"
@echo " stdlib/async/ - Async functions"
@echo " stdlib/eval/ - Eval function"
@echo " tests/ - Test programs (unittest framework)"
@echo " examples/ - Example programs (.rc files)"
@echo " build/ - Compiled object files"