Skip to content

Commit 678fb76

Browse files
0xrinegadeclaude
andcommitted
feat(ovsm): improve error messages with specific details
Previously, tokenization and parse errors showed generic messages: - ❌ "Failed to tokenize OVSM code" - ❌ "Failed to parse OVSM code" Now shows the actual underlying error: - ✅ "Tokenization error: Syntax error at line 1, column 2: Unexpected character: #" - ✅ "Parse error: Unexpected token: expected Expected THEN or '{' after IF condition, got Newline" This makes debugging MUCH easier by showing exactly where and what went wrong! Example: ```ovsm IF $x > 5 $y = 10 ``` Before: "Failed to parse OVSM code" After: "Parse error: expected THEN or '{' after IF condition, got Newline" 🚀 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 8e88613 commit 678fb76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/services/ovsm_service.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ impl OvsmService {
7272
let mut scanner = Scanner::new(code);
7373
let tokens = scanner
7474
.scan_tokens()
75-
.context("Failed to tokenize OVSM code")?;
75+
.map_err(|e| anyhow::anyhow!("Tokenization error: {}", e))?;
7676

7777
if self.debug {
7878
println!("✅ Tokenization successful ({} tokens)", tokens.len());
7979
}
8080

8181
// Parse the tokens into an AST
8282
let mut parser = Parser::new(tokens);
83-
let program = parser.parse().context("Failed to parse OVSM code")?;
83+
let program = parser.parse().map_err(|e| anyhow::anyhow!("Parse error: {}", e))?;
8484

8585
if self.debug {
8686
println!("✅ Parsing successful");

0 commit comments

Comments
 (0)