jbrave
March 2, 2011, 8:24am
1
would be nice to be able to do something like this:
{500:“internal Server Error”,501:“not implemented”}
just for example, so one could quickly build a table of codes to return value from.
Any suggestions, am I missing something here? I would hate to have to write a massive set of if/then’s to do something like this.
You can always do this:
codes = {}
codes.AddReplace("500","internal Server Error")
codes.AddReplace("501","not implemented")
then
error = SomeFunction() ' returns an Integer
?codes[error.toStr()]
Another option would be to build your table with a leading character:
codes = {x500:"internal Server Error",x501:"not implemented"}
then use:
?codes["x"+error.toStr()]
-JT
Not sure if this is what you were asking, but see this post for a list of error codes. This will be provided as a public AA in a future release.
–Mark
jbrave
March 3, 2011, 12:27am
4
Thanks, I was really looking for the method as opposed to the codes, I used http codes as the example, but this is for a completely different set of codes.
-Joel