Skip to content

Commit dd13a59

Browse files
Merge branch 'verbose'
2 parents efccf8d + b65623e commit dd13a59

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
3131
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3232
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
3333
Tricks = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775"
34+
TruncatedStacktraces = "781d530d-4396-4725-bb49-402e4bee1e77"
3435
ZygoteRules = "700de1a5-db45-46bc-99cf-38207098b444"
3536

3637
[weakdeps]
@@ -77,6 +78,7 @@ Setfield = "0.8, 1"
7778
Static = "0.7, 0.8"
7879
StaticArraysCore = "1.4"
7980
Tricks = "0.1.6"
81+
TruncatedStacktraces = "1"
8082
ZygoteRules = "0.2"
8183
julia = "1.6"
8284

src/DiffEqBase.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ using Static: reduce_tup
3030
import ChainRulesCore
3131
import RecursiveArrayTools
3232
import SparseArrays
33+
import TruncatedStacktraces
3334

3435
import ChainRulesCore: NoTangent, @non_differentiable
3536
import ZygoteRules

src/callbacks.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ end
194194

195195
if integrator.event_last_time == counter &&
196196
minimum(ODE_DEFAULT_NORM(ArrayInterface.allowed_getindex(previous_condition,
197-
ivec), integrator.t)) <=
197+
ivec), integrator.t)) <=
198198
100ODE_DEFAULT_NORM(integrator.last_event_error, integrator.t)
199199

200200
# If there was a previous event, utilize the derivative at the start to
@@ -476,8 +476,8 @@ function find_callback_time(integrator, callback::VectorContinuousCallback, coun
476476
if ArrayInterface.allowed_getindex(event_idx, idx) != 0
477477
function zero_func(abst, p = nothing)
478478
ArrayInterface.allowed_getindex(get_condition(integrator,
479-
callback,
480-
abst), idx)
479+
callback,
480+
abst), idx)
481481
end
482482
if zero_func(top_t) == 0
483483
Θ = top_t

src/solve.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ function Base.showerror(io::IO, e::CommonKwargError)
112112
print(io, "Unrecognized keyword arguments: ")
113113
printstyled(io, unrecognized; bold = true, color = :red)
114114
print(io, "\n\n")
115+
println(io, TruncatedStacktraces.VERBOSE_MSG)
115116
end
116117

117118
@enum KeywordArgError KeywordArgWarn KeywordArgSilent
@@ -137,6 +138,7 @@ struct IncompatibleInitialConditionError <: Exception end
137138

138139
function Base.showerror(io::IO, e::IncompatibleInitialConditionError)
139140
print(io, INCOMPATIBLE_U0_MESSAGE)
141+
println(io, TruncatedStacktraces.VERBOSE_MSG)
140142
end
141143

142144
const NO_DEFAULT_ALGORITHM_MESSAGE = """
@@ -153,6 +155,7 @@ struct NoDefaultAlgorithmError <: Exception end
153155

154156
function Base.showerror(io::IO, e::NoDefaultAlgorithmError)
155157
print(io, NO_DEFAULT_ALGORITHM_MESSAGE)
158+
println(io, TruncatedStacktraces.VERBOSE_MSG)
156159
end
157160

158161
const NO_TSPAN_MESSAGE = """
@@ -163,6 +166,7 @@ struct NoTspanError <: Exception end
163166

164167
function Base.showerror(io::IO, e::NoTspanError)
165168
print(io, NO_TSPAN_MESSAGE)
169+
println(io, TruncatedStacktraces.VERBOSE_MSG)
166170
end
167171

168172
const NON_SOLVER_MESSAGE = """
@@ -180,6 +184,7 @@ struct NonSolverError <: Exception end
180184

181185
function Base.showerror(io::IO, e::NonSolverError)
182186
print(io, NON_SOLVER_MESSAGE)
187+
println(io, TruncatedStacktraces.VERBOSE_MSG)
183188
end
184189

185190
const PROBSOLVER_PAIRING_MESSAGE = """
@@ -200,6 +205,7 @@ function Base.showerror(io::IO, e::ProblemSolverPairingError)
200205
println(io, "Solver type: $(SciMLBase.__parameterless_type(typeof(e.alg)))")
201206
println(io,
202207
"Problem types compatible with the chosen solver: $(compatible_problem_types(e.prob,e.alg))")
208+
println(io, TruncatedStacktraces.VERBOSE_MSG)
203209
end
204210

205211
function compatible_problem_types(prob, alg)
@@ -240,6 +246,7 @@ struct DirectAutodiffError <: Exception end
240246

241247
function Base.showerror(io::IO, e::DirectAutodiffError)
242248
println(io, DIRECT_AUTODIFF_INCOMPATABILITY_MESSAGE)
249+
println(io, TruncatedStacktraces.VERBOSE_MSG)
243250
end
244251

245252
const NONCONCRETE_ELTYPE_MESSAGE = """
@@ -273,6 +280,7 @@ end
273280
function Base.showerror(io::IO, e::NonConcreteEltypeError)
274281
print(io, NONCONCRETE_ELTYPE_MESSAGE)
275282
print(io, e.eltype)
283+
println(io, TruncatedStacktraces.VERBOSE_MSG)
276284
end
277285

278286
const GENERIC_NUMBER_TYPE_ERROR_MESSAGE = """
@@ -298,6 +306,7 @@ function Base.showerror(io::IO, e::GenericNumberTypeError)
298306
println(io, "Solver: $(e.alg)")
299307
println(io, "u0 type: $(e.uType)")
300308
print(io, "Timespan type: $(e.tType)")
309+
println(io, TruncatedStacktraces.VERBOSE_MSG)
301310
end
302311

303312
const COMPLEX_SUPPORT_ERROR_MESSAGE = """
@@ -316,6 +325,7 @@ end
316325
function Base.showerror(io::IO, e::ComplexSupportError)
317326
println(io, COMPLEX_SUPPORT_ERROR_MESSAGE)
318327
println(io, "Solver: $(e.alg)")
328+
println(io, TruncatedStacktraces.VERBOSE_MSG)
319329
end
320330

321331
const COMPLEX_TSPAN_ERROR_MESSAGE = """
@@ -330,6 +340,7 @@ struct ComplexTspanError <: Exception end
330340

331341
function Base.showerror(io::IO, e::ComplexTspanError)
332342
println(io, COMPLEX_TSPAN_ERROR_MESSAGE)
343+
println(io, TruncatedStacktraces.VERBOSE_MSG)
333344
end
334345

335346
const TUPLE_STATE_ERROR_MESSAGE = """
@@ -367,6 +378,7 @@ struct TupleStateError <: Exception end
367378

368379
function Base.showerror(io::IO, e::TupleStateError)
369380
println(io, TUPLE_STATE_ERROR_MESSAGE)
381+
println(io, TruncatedStacktraces.VERBOSE_MSG)
370382
end
371383

372384
const MASS_MATRIX_ERROR_MESSAGE = """
@@ -387,6 +399,7 @@ function Base.showerror(io::IO, e::IncompatibleMassMatrixError)
387399
println(io, e.sz)
388400
print(io, "length(u0): ")
389401
println(e.len)
402+
println(io, TruncatedStacktraces.VERBOSE_MSG)
390403
end
391404

392405
function init_call(_prob, args...; merge_callbacks = true, kwargshandle = KeywordArgWarn,
@@ -1386,6 +1399,7 @@ struct AdjointNotFoundError <: Exception end
13861399

13871400
function Base.showerror(io::IO, e::AdjointNotFoundError)
13881401
print(io, ADJOINT_NOT_FOUND_MESSAGE)
1402+
println(io, TruncatedStacktraces.VERBOSE_MSG)
13891403
end
13901404

13911405
function _concrete_solve_adjoint(args...; kwargs...)
@@ -1402,6 +1416,7 @@ struct ForwardSensitivityNotFoundError <: Exception end
14021416

14031417
function Base.showerror(io::IO, e::ForwardSensitivityNotFoundError)
14041418
print(io, FORWARD_SENSITIVITY_NOT_FOUND_MESSAGE)
1419+
println(io, TruncatedStacktraces.VERBOSE_MSG)
14051420
end
14061421

14071422
function _concrete_solve_forward(args...; kwargs...)

0 commit comments

Comments
 (0)