Firebase FunctionsErrorCode for insufficient balance是什么最好?

huangapple go评论352阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月16日 12:54:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76487050.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定