Skip to content

Errors do not fail gracefull. #69

Description

@rg-wood

Actual behaviour: Errors in the component are fatal, and can cause the entire stat block to not appear.

For example, if the multiattack action points to a non-existent attack ID:

actions='[
          {
            "name": "Multiattack",
            "type": "multiattack",
            "description": "The princess makes two command attacks.",
            "multiAttacks": {
              "id": "claw",
              "number": 2
            }
          },
          {
            "name": "Command",
            "id": "command",
            "type": "ranged-or-melee-attack",
            "bonus": "+5",
            "reach": "5ft.",
            "range": "60ft.",
            "target": "one target",
            "damage": "1d8 + 5",
            "damageType": "slashing"
          }
        ]'

...it fails with the following error:

Uncaught (in promise) TypeError: attack is undefined
    _calculateMultiattack vellum-monster.js:380
    get maxAttackBonus vellum-monster.js:352
    get effectiveAttackBonus vellum-monster.js:317
    get calculatedCrs vellum-monster.js:312
    renderStats vellum-monster.js:127
    render vellum-stat-block.ts:114
    update lit-element.ts:300
    performUpdate updating-element.ts:775
    _enqueueUpdate updating-element.ts:725
    requestUpdateInternal updating-element.ts:690
    initialize updating-element.ts:531
    initialize lit-element.ts:224
    UpdatingElement updating-element.ts:516
    LitElement lit-element.ts:101
    StatBlock vellum-stat-block.ts:5
    Monster vellum-monster.js:13
    <anonymous> vellum-monster.js:405
vellum-monster.js:380:8

Expected behaviour: <vellum-monster> should recover and display as much information as is readable. Errors should be reported to the console.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions