Skip to content

Commit b3cc3ec

Browse files
authored
Handle UNINITIALIZED and OK KV store errors (#1278)
1 parent 363550a commit b3cc3ec

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

runtime/fastly/host-api/host_api.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -885,15 +885,21 @@ FastlyKVError make_fastly_kv_error(fastly::fastly_kv_error kv_error,
885885
err.detail = FastlyKVError::detail::too_many_requests;
886886
return err;
887887
}
888-
case KV_ERROR_INTERNAL_ERROR:
889-
default: {
888+
case KV_ERROR_INTERNAL_ERROR: {
890889
err.detail = FastlyKVError::detail::internal_error;
891890
return err;
892891
}
892+
case KV_ERROR_OK:
893+
case KV_ERROR_UNINITIALIZED:
894+
default: {
895+
// If the hostcall never initialized `kv_error`, or if it claimed
896+
// that it was `OK` but we still failed, then make a host error
897+
// based on the `host_err` value.
898+
err.detail = FastlyKVError::detail::host_error;
899+
err.host_err = host_err;
900+
return err;
901+
}
893902
}
894-
err.detail = FastlyKVError::detail::host_error;
895-
err.host_err = host_err;
896-
return err;
897903
}
898904

899905
FastlyImageOptimizerError

0 commit comments

Comments
 (0)