open-feature / spec

OpenFeature specification
https://openfeature.dev
Apache License 2.0
667 stars 35 forks source link

1.4.7 & 1.4.8: reason vs error code #98

Closed justinabrahms closed 2 years ago

justinabrahms commented 2 years ago

Now that we've changed the wording around reason vs error code, things are a bit foggy for me.

How are they different? Without error code being an enum.. I don't really get how that's different than 1.4.8


Requirement 1.4.7

In cases of abnormal execution, the evaluation details structure's error code field MUST contain a string identifying an error occurred during flag evaluation and the nature of the error.

Some example error codes include: "TARGETING_KEY_MISSING", "PROVIDER_NOT_READY", "FLAG_NOT_FOUND", "PARSE_ERROR", "TYPE_MISMATCH", or "GENERAL".

Requirement 1.4.8

In cases of abnormal execution (network failure, unhandled error, etc) the reason field in the evaluation details SHOULD indicate an error.

toddbaert commented 2 years ago

@justinabrahms reason can (and SHOULD) contain more than just errors. It can also contain something signifying why a flag evaluation occurred the way it did. For example "SPECIFIC_USER_OVERRIDE" or "TARGETING_RULE_MATCH". LD for example has such reasons. The reason should only indicate an error if there was an error. The error code gets specific as to the nature of the error.

See: https://github.com/open-feature/spec/blob/main/specification/flag-evaluation/flag-evaluation.md#requirement-146 (reason in normal execution)

toddbaert commented 2 years ago

I'm closing this since there's been no further discussion, and it seems (based on the :+1: ) the answer is satisfactory.