(I know I can read the SDK and "know" which devices implement the support, but I like to have generic code which handles (at least a subset of) unexpected errors, even if it is to show a more helpful message to the user.
I can trap the SymbolNotAllowedException, but I can't find any way to interrogate it to determine if it is the specific :responseType exception, apart from running equals() on its getErrorMessage() (which is really not nice code) eg:
// Note: the ( after "if" changed to a [ below to avoid an issue in the forum which would break the post
try {
Communications.makeWebRequest(url, params, options, method(:handleDownloadResponse));
} catch (e instanceof Lang.SymbolNotAllowedException) {
// XXX It would be nice if there was a better way to test for this specific error
if [ e.getErrorMessage().equals("Invalid value for :responseType for this device.")) {
handleError(Ui.loadResource(Rez.Strings.errorFitNotSupported));
} else {
handleError(Ui.loadResource(Rez.Strings.errorUnexpectedDownloadError));
}
}
// end
So.. whats a correct way to do this?
Thanks :)
David