Amber icon indicating copy to clipboard operation
Amber copied to clipboard

[Suggestion] Change error message: Failed expression must be followed by a block or statement

Open llagerlof opened this issue 1 year ago • 5 comments

When running a function that requires a failed block (like function parse) but not using failed, an error is raised:

[user@pc test]$ amber program1.ab
[src/modules/condition/failed.rs:64:21] "FAILED" = "FAILED"
 ERROR
Failed expression must be followed by a block or statement
at program1.ab:6:1

I have one suggestion. When the code is using a failing function without failed, the error message could be clearer, like below:

[user@pc test]$ amber program1.ab
 ERROR
The function 'parse' requires a 'failed' block or statement to handle errors
at program1.ab:6:1

llagerlof avatar Jun 17 '24 21:06 llagerlof

The line that gets produced in the error:

[src/modules/condition/failed.rs:64:21] "FAILED" = "FAILED"

Is removed once this PR gets merged https://github.com/Ph0enixKM/Amber/pull/203

Ph0enixKM avatar Jun 18 '24 07:06 Ph0enixKM

This ticket can be closed as the PR was merged?

Mte90 avatar Jun 24 '24 10:06 Mte90

@Mte90 Which PR closes this issue?

Ph0enixKM avatar Jun 30 '24 14:06 Ph0enixKM

#203 as you wrote

Mte90 avatar Jun 30 '24 17:06 Mte90

This only partially closes this issue - we need to change the error message too

Ph0enixKM avatar Jul 01 '24 14:07 Ph0enixKM