Bug report: Error handling inconsistency
- Dominant language
- JavaScript
- Stars
- 35.8k
- Forks
- 4.1k
- Avg merge
- 2d 26m
- Merged PRs (30d)
- 33
Description
**Describe the bug**
Minor issue: Inconsistency in error handling hampers the development of failure test cases.
A test case which includes expectedError: true only records an error if the operation signals it with throw '...', not with throw new OperationError("...")
This means that either the operation must avoid OperationEroor (which seems to be the standard way of doing it) or the test must exactly match the error messge as expectedOutput, making it fragile.
**To Reproduce**
The following test case says the operation which should have failed, succeeded:
{
name: "Text-Integer Conversion: error on 4-byte Unicode (emoji)",
input: "U+1F600", // Grinning face emoji 😀
expectedError: true,
recipeConfig: [
{
op: "Unescape Unicode Characters",
args: [],
},
{
op: "Text-Integer Conversion",
args: ["Decimal"],
},
],
},
**Expected behaviour**
When an operation indicates failure using OperationError, a failure test case containing expectedError: true should detect the failure.
**CyberChef version:**
10.22.1
**Additional context**
Add any other context about the problem here.
Contributor guide
Assessment
This issue has not been assessed yet.