github.com/blend/go-sdk@v1.20220411.3/examples/db/prevent-deadlock/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  	asMulti, ok := err.(*multiError)
    18  	if !ok {
    19  		return err
    20  	}
    21  
    22  	if asMulti == nil || len(asMulti.Errors) == 0 {
    23  		return ex.New("Expected a non-nil / non-empty error")
    24  	}
    25  
    26  	log.Println("Error(s):")
    27  	for _, err := range asMulti.Errors {
    28  		log.Printf("- %#v\n", err)
    29  	}
    30  
    31  	return nil
    32  }