• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

JuliaLang / julia / #37810

15 Jun 2024 10:59PM UTC coverage: 86.727% (-0.8%) from 87.489%
#37810

push

local

web-flow
FieldError shim to avoid breaks in tests (#54809)

Original commit introducing FieldError exception is 7e5d9a3. Since
existing packages were using `ErrorException` to capture `no field`
errors, we need to have a shim to avoid test breaks for external
packages with such uses until they update to `FieldError`.

addressing `need shim for FieldError` #54807

---------

Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>

1 of 3 new or added lines in 1 file covered. (33.33%)

695 existing lines in 27 files now uncovered.

76473 of 88177 relevant lines covered (86.73%)

15289797.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.46
/stdlib/LinearAlgebra/src/exceptions.jl
1
# This file is a part of Julia. License is MIT: https://julialang.org/license
2

3
export LAPACKException,
4
       SingularException,
5
       PosDefException,
6
       RankDeficientException,
7
       ZeroPivotException
8

9
"""
10
    LAPACKException
11

12
Generic LAPACK exception thrown either during direct calls to the [LAPACK functions](@ref man-linalg-lapack-functions)
13
or during calls to other functions that use the LAPACK functions internally but lack specialized error handling. The `info` field
14
contains additional information on the underlying error and depends on the LAPACK function that was invoked.
15
"""
16
struct LAPACKException <: Exception
17
    info::BlasInt
152✔
18
end
19

20
"""
21
    SingularException
22

23
Exception thrown when the input matrix has one or more zero-valued eigenvalues, and is not invertible.
24
A linear solve involving such a matrix cannot be computed.
25
The `info` field indicates the location of (one of) the singular value(s).
26
"""
27
struct SingularException <: Exception
28
    info::BlasInt
205✔
29
end
30

31
"""
32
    PosDefException
33

34
Exception thrown when the input matrix was not [positive definite](https://en.wikipedia.org/wiki/Definiteness_of_a_matrix).
35
Some linear algebra functions and factorizations are only applicable to positive definite matrices.
36
The `info` field indicates the location of (one of) the eigenvalue(s) which is (are) less than/equal to 0.
37
"""
38
struct PosDefException <: Exception
39
    info::BlasInt
166✔
40
end
41
function Base.showerror(io::IO, ex::PosDefException)
×
42
    print(io, "PosDefException: matrix is not ")
×
43
    if ex.info == -1
×
44
        print(io, "Hermitian")
×
45
    else
46
        print(io, "positive definite")
×
47
    end
48
    print(io, "; Factorization failed.")
×
49
end
50

51
"""
52
    RankDeficientException
53

54
Exception thrown when the input matrix is [rank deficient](https://en.wikipedia.org/wiki/Rank_(linear_algebra)). Some
55
linear algebra functions, such as the Cholesky decomposition, are only applicable to matrices that are not rank
56
deficient. The `info` field indicates the computed rank of the matrix.
57
"""
58
struct RankDeficientException <: Exception
59
    info::BlasInt
45✔
60
end
61

62
"""
63
    ZeroPivotException <: Exception
64

65
Exception thrown when a matrix factorization/solve encounters a zero in a pivot (diagonal)
66
position and cannot proceed.  This may *not* mean that the matrix is singular:
67
it may be fruitful to switch to a different factorization such as pivoted LU
68
that can re-order variables to eliminate spurious zero pivots.
69
The `info` field indicates the location of (one of) the zero pivot(s).
70
"""
71
struct ZeroPivotException <: Exception
72
    info::BlasInt
88✔
73
end
74
function Base.showerror(io::IO, ex::ZeroPivotException)
×
75
    print(io, "ZeroPivotException: factorization encountered one or more zero pivots. Consider switching to a pivoted LU factorization.")
×
76
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc