Skip to content

Unparseable custom attribute colors cause a crash #2236

Closed
@byorgey

Description

Describe the bug
In a scenario description, if the fg or bg color specification in a custom attribute cannot be parsed, swarm crashes.

To Reproduce

Try loading the following scenario .yaml file:

version: 1
name: Custom attribute - invalid color
description: |
  Invalid color in custom attribute
creative: false
attrs:
  - name: bogus
    bg: "this is not a color"
terrains:
  - name: whatzit
    attr: bogus
    description: |
      A thingy
robots:
  - name: base
    dir: east
world:
  dsl: |
    {grass}
  palette:
    'B': [grass, null, base]
    '.': [whatzit]
  upperleft: [0, 0]
  map: |
    B.

This results in:

$ ./scripts/play.sh -i Testing/_Validation/unparseable-attr-color.yaml
swarm: Data.Colour.SRGB.sRGB24read: no parse
CallStack (from HasCallStack):
  error, called at ./Data/Colour/SRGB.hs:128:3 in colour-2.3.6-01a45f2577c459ed9632a48ba99a66e313619b5bf990fc54e630e96fb26912b8:Data.Colour.SRGB

Note that the scenario successfully validates and loads; the error is thrown sometime later, perhaps when it is being rendered.

Expected behavior
The scenario should fail to validate with a reasonable error message.

Metadata

Assignees

Labels

BugThe observed behaviour is incorrect or unexpected.C-Low Hanging FruitIdeal issue for new contributors.G-ScenariosAn issue having to do with scenario design, the way scenarios are described and loaded, etc.S-Nice to haveThe bug fix or feature would be nice but doesn't currently have much negative impact.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions