diff --git a/ocaml/sdk-gen/go/templates/ConvertEnum.mustache b/ocaml/sdk-gen/go/templates/ConvertEnum.mustache index 85bb1660c24..5663d04ab01 100644 --- a/ocaml/sdk-gen/go/templates/ConvertEnum.mustache +++ b/ocaml/sdk-gen/go/templates/ConvertEnum.mustache @@ -17,7 +17,7 @@ func deserialize{{func_name_suffix}}(context string, input interface{}) (value { value = {{name}} {{/items}} default: - err = fmt.Errorf("unable to parse XenAPI response: got value %q for enum %s at %s, but this is not any of the known values", strValue, "{{type}}", context) + value = {{type}}Unrecognized } return } diff --git a/ocaml/sdk-gen/go/templates/Enum.mustache b/ocaml/sdk-gen/go/templates/Enum.mustache index 1b668dd19bc..5288573e5da 100644 --- a/ocaml/sdk-gen/go/templates/Enum.mustache +++ b/ocaml/sdk-gen/go/templates/Enum.mustache @@ -6,6 +6,8 @@ const ( //{{#doc}} {{.}}{{/doc}} {{name}} {{type}} = "{{value}}" {{/values}} + // The value does not belong to this enumeration + {{name}}Unrecognized {{name}} = "unrecognized" ) {{/enums}} \ No newline at end of file diff --git a/ocaml/sdk-gen/go/test_data/enum.go b/ocaml/sdk-gen/go/test_data/enum.go index 0a0e17be7d3..db0e9d6994c 100644 --- a/ocaml/sdk-gen/go/test_data/enum.go +++ b/ocaml/sdk-gen/go/test_data/enum.go @@ -5,4 +5,6 @@ const ( VMTelemetryFrequencyDaily VMTelemetryFrequency = "daily" // Run telemetry task weekly VMTelemetryFrequencyWeekly VMTelemetryFrequency = "weekly" + // The value does not belong to this enumeration + VMTelemetryFrequencyUnrecognized VMTelemetryFrequency = "unrecognized" ) diff --git a/ocaml/sdk-gen/go/test_data/enum_convert.go b/ocaml/sdk-gen/go/test_data/enum_convert.go index 40129c0e5ca..737436cc192 100644 --- a/ocaml/sdk-gen/go/test_data/enum_convert.go +++ b/ocaml/sdk-gen/go/test_data/enum_convert.go @@ -14,7 +14,7 @@ func deserializeEnumTaskStatusType(context string, input interface{}) (value Tas case "success": value = TaskStatusTypeSuccess default: - err = fmt.Errorf("unable to parse XenAPI response: got value %q for enum %s at %s, but this is not any of the known values", strValue, "TaskStatusType", context) + value = TaskStatusTypeUnrecognized } return } \ No newline at end of file