Skip to main content
Glama
generic_error.go1.05 kB
package error import "net/http" // GenericError represent as the contract of generic error type GenericError interface { Error() string ErrCode() string StatusCode() int } type InternalServerError string // Error for complying the error interface func (e InternalServerError) Error() string { return string(e) } // ErrCode will return the error code based on the error data type func (e InternalServerError) ErrCode() string { return "INTERNAL_SERVER_ERROR" } // StatusCode will return the HTTP status code based on the error data type func (e InternalServerError) StatusCode() int { return http.StatusInternalServerError } type ContextError string // Error for complying the error interface func (e ContextError) Error() string { return string(e) } // ErrCode will return the error code based on the error data type func (e ContextError) ErrCode() string { return "CONTEXT_ERROR" } // StatusCode will return the HTTP status code based on the error data type func (e ContextError) StatusCode() int { return http.StatusRequestTimeout }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samihalawa/whatsapp-go-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server