github.com/gogf/gf/v2@v2.7.4/errors/gerror/gerror_error_json.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/gogf/gf.
     6  
     7  package gerror
     8  
     9  // MarshalJSON implements the interface MarshalJSON for json.Marshal.
    10  // Note that do not use pointer as its receiver here.
    11  func (err Error) MarshalJSON() ([]byte, error) {
    12  	return []byte(`"` + err.Error() + `"`), nil
    13  }