Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability for errors messages to link to error explanations #1789

Merged
merged 5 commits into from
Jul 22, 2024

Conversation

mtoy-googly-moogly
Copy link
Collaborator

As mentioned in #1787 this adds the ability for an error message to contain a link to a longer error explanation.

  • If an error messages ends with [xxx] then the xxx is extracted and added to the log entry as an error code
  • Error message explanations will be added to https://docs.malloydata.dev/documentation/error_dictionary, since each section of the markdown file has a target, the target portion of the url is the "error code" which should be added to the message
  • The VS Code extension is modified to display errors which contain a code, with a link to the error dictionary containing the target.

For example

        this.log(
          `pick type '${whenType}', expected '${returnType.dataType}'[pick-values-must-match]`
        );
## Pick values must match
The types of each `pick` (and the `else` if it is present), in a pick statement must match.
A message `type 'TYPENAME', expected 'TYPENAME'` indicates that the referenced source line
contains an expression whose type does not match the first `pick` in the pick statement. For example,
the following code would generate this error

   select: bad_pick is pick 1 when true else 'one'

log(logMsg: LogMessage): void {
const tagged = logMsg.message.match(/^(.+)\[(.+)]$/);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with 'a[' and with many repetitions of 'a[a'.
This
regular expression
that depends on
library input
may run slow on strings starting with 'a[' and with many repetitions of 'a[a'.
@mtoy-googly-moogly mtoy-googly-moogly merged commit 6227872 into main Jul 22, 2024
9 checks passed
@mtoy-googly-moogly mtoy-googly-moogly deleted the add-error-links branch July 22, 2024 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant