File tree 1 file changed +6
-11
lines changed
1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 10
10
falsePromise = & Promise {ok : false }
11
11
)
12
12
13
+ var (
14
+ AtomPanicError = NewAtom ("panic_error" )
15
+ )
16
+
13
17
// PromiseFunc defines the type of a function that returns a promise.
14
18
type PromiseFunc = func (context.Context ) * Promise
15
19
@@ -165,9 +169,9 @@ func panicError(r interface{}) error {
165
169
case Exception :
166
170
return r
167
171
case error :
168
- return Exception {term : atomError .Apply (NewAtom ( "panic_error" ) .Apply (NewAtom (r .Error ())))}
172
+ return Exception {term : atomError .Apply (AtomPanicError .Apply (NewAtom (r .Error ())))}
169
173
default :
170
- return Exception {term : atomError .Apply (NewAtom ( "panic_error" ) .Apply (NewAtom (fmt .Sprintf ("%v" , r ))))}
174
+ return Exception {term : atomError .Apply (AtomPanicError .Apply (NewAtom (fmt .Sprintf ("%v" , r ))))}
171
175
}
172
176
}
173
177
@@ -217,12 +221,3 @@ func (s *promiseStack) recover(err error) error {
217
221
// went through all the ancestor promises and still got the unhandled error.
218
222
return err
219
223
}
220
-
221
- // PanicError is an error thrown once panic occurs during the execution of a promise.
222
- type PanicError struct {
223
- OriginErr error
224
- }
225
-
226
- func (p PanicError ) Error () string {
227
- return fmt .Sprintf ("panic: %v" , p .OriginErr )
228
- }
You can’t perform that action at this time.
0 commit comments