diff options
| author | eileencodes <eileencodes@gmail.com> | 2024-02-05 14:39:29 -0500 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-02-06 20:49:33 +0000 |
| commit | 936c0ab5e807e7060e6fc65a3c45015c131ae873 (patch) | |
| tree | b35399f77d5c7344b9457a57d5ab7dc882781a05 /.github | |
| parent | c3403322df7d81cd9426310bd7833d005b2a7ac7 (diff) | |
[ruby/prism] Implement file parsing error handling
This PR implements proper file parsing error handling. Previously
`file_options` would call `pm_string_mapped_init` which would print an
error from `perror`. However this wouldn't raise a proper Ruby error so
it was just a string output. I've done the following:
- Raise an error from `rb_syserr_fail` with the filepath in
`file_options`.
- No longer return `Qnil` if `file_options` returns false (because now
it will raise)
- Update `file_options` to return `static void` instead of `static
bool`.
- Update `file_options` and `profile_file` to check the type so when
passing `nil` we see a `TypeError`.
- Delete `perror` from `pm_string_mapped_init`
- Update `FFI` backend to raise appropriate errors when calling
`pm_string_mapped_init`.
- Add tests for `dump_file`, `lex_file`, `parse_file`,
`parse_file_comments`, `parse_lex_file`, and `parse_file_success?`
when a file doesn't exist and for `nil`.
- Updates the `bin/parse` script to no longer raise it's own
`ArgumentError` now that we raise a proper error.
Fixes: ruby/prism#2207
https://github.com/ruby/prism/commit/b2f7494ff5
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions
