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 options to binary construction error_info formatting #5752

Merged
merged 1 commit into from Mar 1, 2022

Conversation

josevalim
Copy link
Contributor

@josevalim josevalim commented Feb 25, 2022

The new options are:

  • override_segment_position is used by erl_eval/eval_bits
    to override the actual binary segment

  • pretty_printer can be used by other BEAM languages to
    customize how values in error messages are printed

Prior to this commit, binary construction errors in the
shell reported the following:

1> A = "foo".
"foo"
2> <<A/integer>>.
** exception error: bad argument
     in function  eval_bits:eval_exp_field1/6 (eval_bits.erl, line 123)

With this commit:

1> A = "foo".
"foo"
2> <<A/integer>>.
** exception error: construction of binary failed
     in function  eval_bits:eval_exp_field/6 (src/eval_bits.erl, line 143)
        *** segment 1 of type 'integer': expected an integer but got: "foo"
3> <<0, A/integer>>.
** exception error: construction of binary failed
     in function  eval_bits:eval_exp_field/6 (src/eval_bits.erl, line 143)
        *** segment 2 of type 'integer': expected an integer but got: "foo"

@github-actions
Copy link
Contributor

github-actions bot commented Feb 25, 2022

CT Test Results

       5 files     251 suites   1h 59m 46s ⏱️
4 066 tests 3 829 ✔️ 223 💤 14
4 851 runs  4 560 ✔️ 277 💤 14

For more details on these failures, see this check.

Results for commit 5a521ef.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@bjorng bjorng self-assigned this Feb 25, 2022
@bjorng bjorng added the team:VM Assigned to OTP team VM label Feb 25, 2022
@bjorng
Copy link
Contributor

bjorng commented Feb 25, 2022

Thanks for your pull request.

The test case shell_SUITE:otp_5327/1 for STDLIB fails.

* override_segment_position is used by erl_eval/eval_bits
  to override the actual binary segment

* pretty_printer can be used by other BEAM languages to
  customize how values in error messages are printed

Prior to this commit, binary construction errors in the
shell reported the following:

    1> A = "foo".
    "foo"
    2> <<A/integer>>.
    ** exception error: bad argument
         in function  eval_bits:eval_exp_field1/6 (eval_bits.erl, line 123)

With this commit:

    1> A = "foo".
    "foo"
    2> <<A/integer>>.
    ** exception error: construction of binary failed
         in function  eval_bits:eval_exp_field/6 (src/eval_bits.erl, line 143)
            *** segment 1 of type 'integer': expected an integer but got: "foo"
    3> <<0, A/integer>>.
    ** exception error: construction of binary failed
         in function  eval_bits:eval_exp_field/6 (src/eval_bits.erl, line 143)
            *** segment 2 of type 'integer': expected an integer but got: "foo"
@josevalim
Copy link
Contributor Author

@bjorng fixed, ty!

@bjorng bjorng added the testing currently being tested, tag is used by OTP internal CI label Feb 27, 2022
@bjorng
Copy link
Contributor

bjorng commented Feb 27, 2022

Thanks! Added to our daily builds.

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.

This PR looks good to me and no issues were found in our daily builds.

Will you update the EEP?

@josevalim
Copy link
Contributor Author

@bjorng erlang/eep#41

@bjorng bjorng merged commit 0277e47 into erlang:master Mar 1, 2022
@bjorng
Copy link
Contributor

bjorng commented Mar 1, 2022

Thanks for your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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