# Can't get pretty error printing in \`Meta.parse()\`

**URL:** https://discourse.julialang.org/t/cant-get-pretty-error-printing-in-meta-parse/82961
**Category:** New to Julia
**Tags:** question
**Created:** [June 18, 2022, 9:59am UTC](https://discourse.julialang.org/t/cant-get-pretty-error-printing-in-meta-parse/82961 "2022-06-18T09:59:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AlexFreik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexfreik/32/35471_2.png) [@AlexFreik](https://discourse.julialang.org/u/AlexFreik)
#### Post date: [June 18, 2022, 9:59am UTC](https://discourse.julialang.org/t/cant-get-pretty-error-printing-in-meta-parse/82961/1 "2022-06-18T09:59:34Z")

</div>

`showerror` doesn’t seems to work for `Meta.parse()`. For example, when i type `5 sin` I get a nice messge.

```julia
julia> 5 sin
ERROR: syntax: extra token "sin" after end of expression

```

But if I type `Meta.parse("5 sin")` it doesn’t look so good.

```julia
julia> Meta.parse("5 sin")
ERROR: Base.Meta.ParseError("extra token \"sin\" after end of expression")

```

Is it supposed to be like this?  
And how can i convert this error to a nice error string? (I am trying to convert errors to pretty string with `sprint(showerror, error)`, and it doesn’t work with `Base.Meta.ParseError`)

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [June 18, 2022, 10:36am UTC](https://discourse.julialang.org/t/cant-get-pretty-error-printing-in-meta-parse/82961/2 "2022-06-18T10:36:34Z")

</div>

No, I don’t think so - there’s no method for `Meta.ParseError` (you can check by going through the list `methods(showerror)`).

The first “pretty printing” is done by the parser itself, I think. `Meta.parse` just calls into the parser, which seems to return the `ParseError` object.

Could you open an issue for this?

---

<div class="post-metadata">

### Author: ![AlexFreik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexfreik/32/35471_2.png) [@AlexFreik](https://discourse.julialang.org/u/AlexFreik)
#### Post date: [June 18, 2022, 10:46am UTC](https://discourse.julialang.org/t/cant-get-pretty-error-printing-in-meta-parse/82961/3 "2022-06-18T10:46:13Z")

</div>

Thanks for the reply!

> No, I don’t think so - there’s no method for `Meta.ParseError`

Yes, maybe they forgot to add a method for this error.

> Could you open an issue for this?

Yes, good idea

---

<div class="post-metadata">

### Author: ![AlexFreik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexfreik/32/35471_2.png) [@AlexFreik](https://discourse.julialang.org/u/AlexFreik)
#### Post date: [June 18, 2022, 10:52am UTC](https://discourse.julialang.org/t/cant-get-pretty-error-printing-in-meta-parse/82961/4 "2022-06-18T10:52:27Z")

</div>

Opened a new issue  
[https://github.com/JuliaLang/julia/issues/45730](https://github.com/JuliaLang/julia/issues/45730)
