简体   繁体   English

UI 中的 Guidewire 异常处理

[英]Guidewire Exception handling in UI

when internal Guidewire code throws an exception you get a nicely formatted error message box.当内部 Guidewire 代码抛出异常时,您会得到一个格式正确的错误消息框。 However, when custom code throws an exception you are directed to the error page (with the red stack trace text & back to application button).但是,当自定义代码引发异常时,您将被定向到错误页面(带有红色堆栈跟踪文本和返回应用程序按钮)。 Is there anything in the Guidewire framework to make proper UI handling of errors nicer? Guidewire 框架中是否有任何东西可以使正确的 UI 错误处理更好?

such as: < TextBox value="user.someMethod()"/>如:<TextBox value="user.someMethod()"/>

//someMethod code...
try{
    return user.someOtherCode()
}catch(e : Exception){
    //TODO: gracefully display erorr mesage on page
    //e.g.   showErrorMessage()
    return null
}

After some searching through Guidewire OOTB code UserDisplayableExceptions are what you need - answering myself in case someone else has this thought.在通过 Guidewire OOTB 代码进行一些搜索之后,您需要的是 UserDisplayableExceptions - 回答我自己,以防其他人有这个想法。

function goToPolicy(bulkDocumentDownload : BulkDocDownload_Avi) {
  try {
    throw new IndexOutOfBoundsException("Ops! some index out of bounds exception was thrown")
  } catch (e : Exception) {
    throw new com.guidewire.pl.web.controller.UserDisplayableException(e.Message)
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM