英文:
What is the best Firebase FunctionsErrorCode for insufficient balance?
问题
这是Firebase函数错误代码列表:
FunctionsErrorCode = "ok" | "cancelled" | "unknown" | "invalid-argument" | "deadline-exceeded" | "not-found" | "already-exists" | "permission-denied" | "resource-exhausted" | "failed-precondition" | "aborted" | "out-of-range" | "unimplemented" | "internal" | "unavailable" | "data-loss" | "unauthenticated";
当出现"余额不足"时,应该使用哪个FunctionsErrorCode?是aborted还是failed-precondition还是invalid-arguments?
英文:
This is the list of Firebase functions error code
FunctionsErrorCode = "ok" | "cancelled" | "unknown" | "invalid-argument" | "deadline-exceeded" | "not-found" | "already-exists" | "permission-denied" | "resource-exhausted" | "failed-precondition" | "aborted" | "out-of-range" | "unimplemented" | "internal" | "unavailable" | "data-loss" | "unauthenticated";
When "insufficient balance" happens, what FunctionsErrorCode we should use? Is it aborted or failed-precondition or invalid-arguments?
答案1
得分: 1
文档中明确指出,它是用于“可调用的HTTPS触发器”的,因此您不应该感到受其限制,用于其他类型。
然而,在该协议中似乎没有针对402响应的枚举,所以我可能会选择(更通用的)400响应,该协议将其映射到INVALID_ARGUMENT。
英文:
The documentation you link specifically says it's for "Callable HTTPS tigger", so you should not feel yourself bound to it for other types.
There seems to be no enum for a 402 response in that proto though, so I'd probably go for a (more generic) 400 response, which the proto maps to INVALID_ARGUMENT.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论