How javascript try…catch statement works

前端 未结 5 823
伪装坚强ぢ
伪装坚强ぢ 2020-12-18 04:22

I am trying to test in browsermob if certain input field work or not. I am attempting to use a try...catch statement which I have never used before. I know that the form is:

5条回答
  •  一生所求
    2020-12-18 04:40

    According to ECMAScript specifications,

    try {
        // Code
    } catch (varName) {  // optional if 'finally' block is present.
      if (condition) {   // eg. (varName instanceof URIError)
        // Condition (Type) specific error handling
      }
      else {
        // Generic error handling
      }
    } finally {          // Optional if 'catch' block is present.
        // Execute this block after
        // try or after catch clause
        // (i.e. this is *always* called)
    }
    

提交回复
热议问题