Minor rewrite to avoid multiple catch blocks in one statement (JS no likey)
Signed-off-by: Erik de Bruin <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b9d15cf4 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b9d15cf4 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b9d15cf4 Branch: refs/heads/develop Commit: b9d15cf4a2979dbf6786165073317243fa063251 Parents: 39e5a90 Author: Erik de Bruin <[email protected]> Authored: Fri Oct 24 12:59:39 2014 +0200 Committer: Erik de Bruin <[email protected]> Committed: Fri Oct 24 13:04:19 2014 +0200 ---------------------------------------------------------------------- .../framework/src/mx/binding/Binding.as | 74 ++++++++++---------- .../framework/src/mx/binding/Watcher.as | 56 +++++++-------- 2 files changed, 63 insertions(+), 67 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b9d15cf4/frameworks/projects/framework/src/mx/binding/Binding.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/binding/Binding.as b/frameworks/projects/framework/src/mx/binding/Binding.as index b2e0598..6122921 100644 --- a/frameworks/projects/framework/src/mx/binding/Binding.as +++ b/frameworks/projects/framework/src/mx/binding/Binding.as @@ -423,46 +423,44 @@ public class Binding wrappedFunctionSuccessful = true; return result; } - catch(itemPendingError:ItemPendingError) - { - itemPendingError.addResponder(new EvalBindingResponder(this, object)); - if (BindingManager.debugDestinationStrings[destString]) - { - trace("Binding: destString = " + destString + ", error = " + itemPendingError); - } - } - catch(rangeError:RangeError) - { - if (BindingManager.debugDestinationStrings[destString]) - { - trace("Binding: destString = " + destString + ", error = " + rangeError); - } - } catch(error:Error) { - // Certain errors are normal when executing a srcFunc or destFunc, - // so we swallow them: - // Error #1006: Call attempted on an object that is not a function. - // Error #1009: null has no properties. - // Error #1010: undefined has no properties. - // Error #1055: - has no properties. - // Error #1069: Property - not found on - and there is no default value - // We allow any other errors to be thrown. - if ((error.errorID != 1006) && - (error.errorID != 1009) && - (error.errorID != 1010) && - (error.errorID != 1055) && - (error.errorID != 1069)) - { - throw error; - } - else - { - if (BindingManager.debugDestinationStrings[destString]) - { - trace("Binding: destString = " + destString + ", error = " + error); - } - } + if (error is ItemPendingError) { + error.addResponder(new EvalBindingResponder(this, object)); + if (BindingManager.debugDestinationStrings[destString]) + { + trace("Binding: destString = " + destString + ", error = " + error); + } + } else if (error is RangeError) { + if (BindingManager.debugDestinationStrings[destString]) + { + trace("Binding: destString = " + destString + ", error = " + error); + } + } else { + // Certain errors are normal when executing a srcFunc or destFunc, + // so we swallow them: + // Error #1006: Call attempted on an object that is not a function. + // Error #1009: null has no properties. + // Error #1010: undefined has no properties. + // Error #1055: - has no properties. + // Error #1069: Property - not found on - and there is no default value + // We allow any other errors to be thrown. + if ((error.errorID != 1006) && + (error.errorID != 1009) && + (error.errorID != 1010) && + (error.errorID != 1055) && + (error.errorID != 1069)) + { + throw error; + } + else + { + if (BindingManager.debugDestinationStrings[destString]) + { + trace("Binding: destString = " + destString + ", error = " + error); + } + } + } } return null; http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b9d15cf4/frameworks/projects/framework/src/mx/binding/Watcher.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/framework/src/mx/binding/Watcher.as b/frameworks/projects/framework/src/mx/binding/Watcher.as index ac35300..fef6ee3 100644 --- a/frameworks/projects/framework/src/mx/binding/Watcher.as +++ b/frameworks/projects/framework/src/mx/binding/Watcher.as @@ -199,37 +199,35 @@ public class Watcher { wrappedFunction.apply(this); } - catch(itemPendingError:ItemPendingError) - { - // The parent's value is not yet available. This is being ignored for now - - // updateParent() will be called when the parent has a value. - value = null; - } - catch(rangeError:RangeError) - { - // The parent's value is not yet available. This is being ignored for now - - // updateParent() will be called when the parent has a value. - value = null; - } catch(error:Error) { - // Certain errors are normal when executing an update, so we swallow them: - // Error #1006: Call attempted on an object that is not a function. - // Error #1009: null has no properties. - // Error #1010: undefined has no properties. - // Error #1055: - has no properties. - // Error #1069: Property - not found on - and there is no default value - // Error #1507: - invalid null argument. - // We allow any other errors to be thrown. - if ((error.errorID != 1006) && - (error.errorID != 1009) && - (error.errorID != 1010) && - (error.errorID != 1055) && - (error.errorID != 1069) && - (error.errorID != 1507)) - { - throw error; - } + if (error is ItemPendingError) { + // The parent's value is not yet available. This is being ignored for now - + // updateParent() will be called when the parent has a value. + value = null; + } else if (error is RangeError) { + // The parent's value is not yet available. This is being ignored for now - + // updateParent() will be called when the parent has a value. + value = null; + } else { + // Certain errors are normal when executing an update, so we swallow them: + // Error #1006: Call attempted on an object that is not a function. + // Error #1009: null has no properties. + // Error #1010: undefined has no properties. + // Error #1055: - has no properties. + // Error #1069: Property - not found on - and there is no default value + // Error #1507: - invalid null argument. + // We allow any other errors to be thrown. + if ((error.errorID != 1006) && + (error.errorID != 1009) && + (error.errorID != 1010) && + (error.errorID != 1055) && + (error.errorID != 1069) && + (error.errorID != 1507)) + { + throw error; + } + } } }
