github.com/blend/go-sdk@v1.20220411.3/ex/class.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 ex
     9  
    10  import "encoding/json"
    11  
    12  // Class is a string wrapper that implements `error`.
    13  // Use this to implement constant exception causes.
    14  type Class string
    15  
    16  // Class implements `error`.
    17  func (c Class) Error() string {
    18  	return string(c)
    19  }
    20  
    21  // MarshalJSON implements json.Marshaler.
    22  func (c Class) MarshalJSON() ([]byte, error) {
    23  	return json.Marshal(string(c))
    24  }