7777is_strict (:: Prep{Nothing} ) = Val (false )
7878is_strict (:: Prep ) = Val (true )
7979
80- function inconsistent_signatures_error (SIG, RUNTIME_SIG)
80+ struct PreparationMismatchError{SIG,RUNTIME_SIG} <: Exception end
81+
82+ function PreparationMismatchError (:: Type{SIG} , :: Type{RUNTIME_SIG} ) where {SIG,RUNTIME_SIG}
83+ return PreparationMismatchError {SIG,RUNTIME_SIG} ()
84+ end
85+
86+ function Base. showerror (
87+ io:: IO , e:: PreparationMismatchError{SIG,RUNTIME_SIG}
88+ ) where {SIG,RUNTIME_SIG}
8189 msg = """
8290 Inconsistent signatures:
8391 - at preparation time: $SIG
8492 - at execution time: $RUNTIME_SIG
8593 """
86- return ArgumentError ( msg)
94+ return print (io, msg)
8795end
8896
8997function signature (
@@ -138,7 +146,7 @@ function check_prep(
138146 if SIG != = Nothing
139147 RUNTIME_SIG = typeof ((f, backend, x, contexts))
140148 if SIG != RUNTIME_SIG
141- throw (inconsistent_signatures_error (SIG, RUNTIME_SIG))
149+ throw (PreparationMismatchError (SIG, RUNTIME_SIG))
142150 end
143151 end
144152end
@@ -149,7 +157,7 @@ function check_prep(
149157 if SIG != = Nothing
150158 RUNTIME_SIG = typeof ((f!, y, backend, x, contexts))
151159 if SIG != RUNTIME_SIG
152- throw (inconsistent_signatures_error (SIG, RUNTIME_SIG))
160+ throw (PreparationMismatchError (SIG, RUNTIME_SIG))
153161 end
154162 end
155163end
@@ -160,7 +168,7 @@ function check_prep(
160168 if SIG != = Nothing
161169 RUNTIME_SIG = typeof ((f, backend, x, t, contexts))
162170 if SIG != RUNTIME_SIG
163- throw (inconsistent_signatures_error (SIG, RUNTIME_SIG))
171+ throw (PreparationMismatchError (SIG, RUNTIME_SIG))
164172 end
165173 end
166174end
@@ -171,7 +179,7 @@ function check_prep(
171179 if SIG != = Nothing
172180 RUNTIME_SIG = typeof ((f!, y, backend, x, t, contexts))
173181 if SIG != RUNTIME_SIG
174- throw (inconsistent_signatures_error (SIG, RUNTIME_SIG))
182+ throw (PreparationMismatchError (SIG, RUNTIME_SIG))
175183 end
176184 end
177185end
0 commit comments