2021-01-21 11:56:30 +00:00
|
|
|
package spec
|
|
|
|
|
|
|
|
// ParsingError is an error from parsing interface methods
|
|
|
|
type ParsingError string
|
|
|
|
|
|
|
|
func (err ParsingError) Error() string {
|
|
|
|
switch err {
|
|
|
|
case UnknownOperationError:
|
|
|
|
return "unknown operation"
|
|
|
|
case UnsupportedNameError:
|
|
|
|
return "method name is not supported"
|
2021-02-01 14:39:20 +00:00
|
|
|
case UnsupportedReturnError:
|
|
|
|
return "this type of return is not supported"
|
2021-01-21 11:56:30 +00:00
|
|
|
case InvalidQueryError:
|
|
|
|
return "invalid query"
|
|
|
|
case InvalidParamError:
|
|
|
|
return "parameters do not match the query"
|
2021-01-27 12:15:25 +00:00
|
|
|
case InvalidUpdateFieldsError:
|
|
|
|
return "update fields is invalid"
|
2021-01-21 11:56:30 +00:00
|
|
|
case ContextParamRequiredError:
|
|
|
|
return "context parameter is required"
|
|
|
|
case StructFieldNotFoundError:
|
|
|
|
return "struct field not found"
|
|
|
|
}
|
|
|
|
return string(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// parsing error constants
|
|
|
|
const (
|
|
|
|
UnknownOperationError ParsingError = "ERROR_UNKNOWN_OPERATION"
|
|
|
|
UnsupportedNameError ParsingError = "ERROR_UNSUPPORTED"
|
2021-02-01 14:39:20 +00:00
|
|
|
UnsupportedReturnError ParsingError = "ERROR_UNSUPPORTED_RETURN"
|
2021-01-21 11:56:30 +00:00
|
|
|
InvalidQueryError ParsingError = "ERROR_INVALID_QUERY"
|
|
|
|
InvalidParamError ParsingError = "ERROR_INVALID_PARAM"
|
2021-01-27 12:15:25 +00:00
|
|
|
InvalidUpdateFieldsError ParsingError = "ERROR_INVALID_UPDATE_FIELDS"
|
2021-01-21 11:56:30 +00:00
|
|
|
ContextParamRequiredError ParsingError = "ERROR_CONTEXT_PARAM_REQUIRED"
|
|
|
|
StructFieldNotFoundError ParsingError = "ERROR_STRUCT_FIELD_NOT_FOUND"
|
|
|
|
)
|