24 lines
		
	
	
		
			403 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			403 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package errorutil
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| )
 | |
| 
 | |
| // PanicError can be used to not print stacktrace twice
 | |
| type PanicError struct {
 | |
| 	recovered any
 | |
| 	stack     []byte
 | |
| }
 | |
| 
 | |
| func NewPanicError(recovered any, stack []byte) *PanicError {
 | |
| 	return &PanicError{recovered: recovered, stack: stack}
 | |
| }
 | |
| 
 | |
| func (e PanicError) Error() string {
 | |
| 	return fmt.Sprint(e.recovered)
 | |
| }
 | |
| 
 | |
| func (e PanicError) Stack() []byte {
 | |
| 	return e.stack
 | |
| }
 | 
