命名加载器错误
我编写了一个加载器类,它有一个 tries
属性,该属性指示返回错误代码时重试加载 url 的次数。例如,对于 Twitter,如果返回失败鲸鱼,加载器将重试加载方法调用,因为下一次调用可能会返回成功。
我指定了可以使用字符串常量分派的许多错误,因此有 XMLLoaderError.IO
、XMLLoaderError.SECURITY
等。我很难想出该错误的名称。如果尝试次数超过 tries
属性,则会调度错误。起初,我认为是 XMLLoaderError.TRIES_EXCEEDED
,但我确信还有更好的东西。我考虑过 XMLLoaderError.TIMEOUT
,但超时更多的是单个加载错误。或者我可以聪明地使用 XMLLoaderError.TRYOUT
(jk) 有什么想法吗?
I wrote a loader class that has a tries
property that indicates how many times to retry loading a url if an error code is returned. For instance with Twitter, the loader would retry loading a method call if a fail whale is returned, since the next call would probably return success.
I specify the many errors that can be dispatched with string constants, so there's XMLLoaderError.IO
, XMLLoaderError.SECURITY
, etc. I'm having trouble thinking of a name for the error dispatched if the number of tries exceeds the tries
property. At first, I thought XMLLoaderError.TRIES_EXCEEDED
, but I'm certain there's something better out there. I considered XMLLoaderError.TIMEOUT
, but timeout is more of a single load error. Or I can be clever and use XMLLoaderError.TRYOUT
(jk) Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于您的其他错误表明发生的错误的类型/类型 - 即。 “SECURITY”或“IO” - 这些都在 XMLLoader 上下文中,为什么不直接将其命名为 TRY? XMLLoaderError.TRY 对我来说很有意义 - 或者实际上,XMLLoaderError.RETRIES 可能更有意义!
Since your other errors indicate the type/genre of error that occurred - ie. "SECURITY" or "IO" - and these are within the XMLLoader context, why not just name it TRY? XMLLoaderError.TRY makes sense to me - or actually, XMLLoaderError.RETRIES probably makes even more sense!