Skip to content

Bug report: Error handling inconsistency #2227

@p-leriche

Description

@p-leriche

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions