Files
thesis/julia/src/errors.jl
2021-10-11 21:53:23 -06:00

51 lines
1.9 KiB
Julia

struct LaGuerreConway_Error <: Exception end
Base.showerror(io::IO, e::LaGuerreConway_Error) = print(io, "LaGuerre-Conway didn't converge")
struct ΔVsize_Error <: Exception
ΔV::Float64
end
Base.showerror(io::IO, e::ΔVsize_Error) = print(io, "ΔV was too big: $(e.ΔV)")
struct HitPlanet_Error <: Exception end
Base.showerror(io::IO, e::HitPlanet_Error) = print(io, "spacecraft hit the planet...")
struct Convergence_Error <: Exception end
Base.showerror(io::IO, e::Convergence_Error) = print(io, "NLP solver didn't converge...")
struct GenOrbit_Error <: Exception end
Base.showerror(io::IO, e::GenOrbit_Error) = print(io, "infinite Loop trying to generate the init orbit")
struct V∞_Error <: Exception
v∞_in::AbstractVector
v∞_out::AbstractVector
end
Base.showerror(io::IO, e::V∞_Error) = print(io, """v∞s weren't the same:
v1 = $(e.v∞_in) and
v2 = $(e.v∞_out)
difference: $(norm(e.v∞_in) - norm(e.v∞_out))""")
struct PropOne_Error <: Exception
ΔV_unit::AbstractVector
end
Base.showerror(io::IO, e::PropOne_Error) = print(io, "tried to prop a unit ΔV of: ", e.ΔV_unit)
struct Mass_Error{T} <: Exception where T <: Real
mass::T
end
Base.showerror(io::IO, e::Mass_Error) = print(io, "mass (", e.mass, ") got too low in propagation")
struct Mission_Creation_Error{T} <: Exception where T <: Real
num_entries::T
end
Base.showerror(io::IO, e::Mission_Creation_Error) = print(io, "Tried to create a mission with $(e.num_entries) entries")
struct Planet_Match_Error{T} <: Exception where T <: Real
state::Vector{T}
planet::Vector{T}
end
Base.showerror(io::IO, e::Planet_Match_Error) = print(io, """"
Spacecraft didn't make it to planet
spacecraft_pos = $(e.state)
planet_pos = $(e.planet)
difference = $(abs(norm(e.state - e.planet)))""")