Skip to content

Commit

Permalink
[DOCS] FieldError exception
Browse files Browse the repository at this point in the history
FieldError was introduced in JuliaLang#54504. This PR adds documentation for the same.

add types to signature in docs

Co-Authored-By: Neven Sajko <[email protected]>
Co-authored-by: Lilith Orion Hafner <[email protected]>
  • Loading branch information
3 people committed Jun 20, 2024
1 parent 4d0149d commit ff707dd
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,34 @@ julia> ex.msg
"""
ErrorException

"""
FieldError(type::DataType, field::Symbol)
An operation tried to access invalid `field` of `type`.
!!! compat "Julia 1.12"
Prior to Julia 1.12, invalid field access threw an [`ErrorException`](@ref)
See [`getfield`](@ref)
# Examples
```jldoctest
julia> struct AB
a::Float32
b::Float64
end
julia> ab = AB(1, 3)
AB(1.0f0, 3.0)
julia> ab.c # field `c` doesn't exist
ERROR: FieldError: type AB has no field c
Stacktrace:
[...]
```
"""
FieldError

"""
WrappedException(msg)
Expand Down
1 change: 1 addition & 0 deletions doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ Core.DivideError
Core.DomainError
Base.EOFError
Core.ErrorException
Core.FieldError
Core.InexactError
Core.InterruptException
Base.KeyError
Expand Down
1 change: 1 addition & 0 deletions doc/src/manual/control-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ below all interrupt the normal flow of control.
| [`DomainError`](@ref) |
| [`EOFError`](@ref) |
| [`ErrorException`](@ref) |
| [`FieldError`](@ref) |
| [`InexactError`](@ref) |
| [`InitError`](@ref) |
| [`InterruptException`](@ref) |
Expand Down

0 comments on commit ff707dd

Please sign in to comment.