gchq / gchq/CyberChef

Bug report: Error handling inconsistency

Open
#2,227 0 comments 1 reaction 0 assignees View on GitHub
bug
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.