github.com/blend/go-sdk@v1.20220411.3/examples/db/statement-timeout/display.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package main 9 10 import ( 11 "log" 12 13 "github.com/blend/go-sdk/ex" 14 ) 15 16 func displayError(err error) error { 17 asEx, ok := err.(*ex.Ex) 18 if !ok { 19 return err 20 } 21 22 if asEx == nil { 23 return ex.New("Expected a non-nil error") 24 } 25 26 if asEx.Inner != nil { 27 return ex.New("Did not expect an inner error") 28 } 29 30 log.Println("Error(s):") 31 log.Printf("- Message: %q\n", asEx.Message) 32 log.Printf("- %#v\n", asEx.Class) 33 return nil 34 }