# Type UVError in base

**URL:** <https://discourse.julialang.org/t/type-uverror-in-base/87>\
**Category:** Internals & Design\
**Created:** [November 1, 2016, 10:29pm UTC](https://discourse.julialang.org/t/type-uverror-in-base/87 "2016-11-01T22:29:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![musm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/musm/32/3675_2.png) [@musm](https://discourse.julialang.org/u/musm)\
**Post date:** [November 1, 2016, 10:29pm UTC](https://discourse.julialang.org/t/type-uverror-in-base/87/1 "2016-11-01T22:29:10Z")

</div>

> <https://github.com/JuliaLang/julia/blob/01e256310227b859651f4622d5c7c68b742ed25d/base/libuv.jl#L57>

This looks a bit troublesome.  
Why is the inner constructor needed?  
The inner constructor also is `::Integer` however `code` only accepts `Int32`.  
I’m led to believe these are bugs.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [November 1, 2016, 10:39pm UTC](https://discourse.julialang.org/t/type-uverror-in-base/87/2 "2016-11-01T22:39:12Z")

</div>

The real question is why do we have this type at all? We shouldn’t be surfacing details of the library we use for I/O to the user.

---

<div class="post-metadata">

**Author:** ![musm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/musm/32/3675_2.png) [@musm](https://discourse.julialang.org/u/musm)\
**Post date:** [November 1, 2016, 10:45pm UTC](https://discourse.julialang.org/t/type-uverror-in-base/87/3 "2016-11-01T22:45:40Z")

</div>

I think it’s primarily used for internal handling of errors with libuv. The type `UVError ` is not exported.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [November 1, 2016, 10:45pm UTC](https://discourse.julialang.org/t/type-uverror-in-base/87/4 "2016-11-01T22:45:58Z")

</div>

> [@musm](#):
>
> The inner constructor also is ::Integer however code only accepts Int32.

This is not a bug. It will not error if you pass in a `Int64`.

---

<div class="post-metadata">

**Author:** ![musm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/musm/32/3675_2.png) [@musm](https://discourse.julialang.org/u/musm)\
**Post date:** [November 1, 2016, 10:50pm UTC](https://discourse.julialang.org/t/type-uverror-in-base/87/5 "2016-11-01T22:50:11Z")

</div>

The `code::Int32` in the `UVError` type will actually do a convert? My understanding was it was more of an assertion.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [November 1, 2016, 11:25pm UTC](https://discourse.julialang.org/t/type-uverror-in-base/87/6 "2016-11-01T23:25:34Z")

</div>

The `::Int32` here is **not** an assertion. It’s a declaration of slot type much like `local a::Int32` or `Vector{Int32}`. When assigning to such a location, there’s an implicit conversion and type assertion.

I believe these are documented in [the types doc](http://julia.readthedocs.io/en/latest/manual/types/) (search for `convert` in the page).
