Skip to content

How to do syntax validation with human readable error messages #480

@tordans

Description

@tordans

I am looking for a way to add syntax validation with human readable error messages to https://trafficsigns.osm-verkehrswende.org/DE?signs=DE:274-30,1042-31[Di-So+12:00-13:00] where the input field is the values that is used in the *:conditional tag.

What is the recommended way to do this?

It looks like the only way is to try-catch new opening_hours(myValue) and return that? But that does not feel right and I don't understand, yet, how getWarnings and the config option locale (which would return translated error messages?) work with this.

I set up a test case at https://stackblitz.com/edit/stackblitz-starters-crgml78u?file=app%2Fpage.tsx to test this in isolation.

What I am looking for is a list of error messages, ideally translated to the given language, that explain what is wrong and how to fix the syntax.

Any hints are appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions