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

stdlib: Fix erl_error to print re compile errors #5366

Merged

Conversation

garazdawi
Copy link
Contributor

When re:run and friends fail because the regexp is invalid it would print in the error message that the regexp was of
an invalid type. Now it will instead print the compilation error message gotten from running re:compile.

Before:

> re:run("asd",")").
** exception error: bad argument
     in function  re:run/2
        called as re:run("asd",")")
        *** argument 2: neither an iodata term nor a compiled regular expression

After:

> re:run("asd",")").
** exception error: bad argument
     in function  re:run/2
        called as re:run("asd",")")
        *** argument 2: could not parse regular expression
                        unmatched parentheses on character 0

When re:run and friends fail because the regexp is invalid
it would print in the error message that the regexp was of
an invalid type. Now it will instead print the compilation
error message gotten from running re:compile.

Before:
    > re:run("asd",")").
    ** exception error: bad argument
         in function  re:run/2
            called as re:run("asd",")")
            *** argument 2: neither an iodata term nor a compiled regular expression

After:
    > re:run("asd",")").
    ** exception error: bad argument
         in function  re:run/2
            called as re:run("asd",")")
            *** argument 2: could not parse regular expression
                            unmatched parentheses on character 0
@garazdawi garazdawi added team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI bug Issue is reported as a bug labels Nov 10, 2021
@garazdawi garazdawi self-assigned this Nov 10, 2021
Copy link
Contributor

@bjorng bjorng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@garazdawi garazdawi merged commit a2050e9 into erlang:maint Nov 16, 2021
@garazdawi garazdawi deleted the lukas/stdlib/better-re-error-messages branch November 16, 2021 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants