Skip to content

[#383] Update error approach in Lorentz

Moremi Vannak requested to merge rinn7e/#383-error-lorentz-2 into master

Description

Problem: Long ago we came up with a standard representation for errors: pair string x where string is there error tag and x can be arbitrary. It has an obvious drawback: when there is no data to attach to an error, x is set to unit and it's more expensive to work with pair string unit than just string. The advantage of this approach is that it's more uniform that contract users can expect only pair string x. However, nowadays FA2 standard permits two types of errors: string or pair string x.

Solution: Add machinary to be able to both fail with string and pair string x in Lorentz by using NoErrorArg in ErrorArg instances. To failwith pair string unit, use UnitErrorArg or (), but UnitErrorArg is preferred.

Related issue(s)

Resolves #383 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Moremi Vannak

Merge request reports