SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
errorhandling techniques in XPages,
    Javascript, Java, Lotusscript and
                         @Formulas
What is error handling?
Errorhandling in:
 ◦@Formula
 ◦Javascript
 ◦Lotusscript
 ◦Java
 ◦xPages

Openlog
Anticipate, detect and process of programming, user and
environment failures or errors

Prevent partially by defensive programming

What counts is what you do with the errors
• Loads of cryptical error messages – no info about triggered
  events
• No central error handling possible - be sparse with your
  @Formulas - use display fields for re-usable calculations
• Defensive programming (@IsError, Test DataTypes:
  @Elements, @IsTime, @IsNumber, @Text ...)
Standard try - catch routine

try {
   // call a function that could error out
   var result = getInvoiceNumbers(customerNumber,invoiceDate);;
}
catch (e) {
    result = "Error in retrieving invoices";
}
// optional use finally runs after the try/catch block
finally {
    window.Forms[0].fldname.value = result
}

Throw your own errors
if (number > 10) { throw "NumberTooHighError" }
Try - catch routine based on error type

try {
   var result = getInvoiceNumbers(customerNumber,invoiceDate);
}
catch (e
   if e == "CustomerNumberException") {
       result = "Incorrect customerNumber";
   }
   else if e == "DateErrorException") {
       result = "Incorrect Date";
   }
   else result = "Error in retrieving invoices";
}
To register a general errorHandler use:

      (window.)onerror=functionname()


This function will have 3 input variables like:
function functionname(msg,url,line_num)


You can use these variables to log/show the error details
◦ use On   Error   blocks
◦                     is a big nono .. you are supposed to
    On Error resume next
  handle things, not ignoring them
◦ You have differtent audiences: users, developers,
  administrators. So throw custom errors.
◦ Then handle specific errors
◦ Option Declare prevents some programmatic errors
◦      Create a template in the new 8.5.1 LS IDE for your error
    new!
    handling blocks in subs and functions
• As with JavaScript use try - catch - finally blocks and
  throw/catch custom errors
Try {
   List list = new ArrayList(getInvoiceNumbers(customerNumber,invoiceD
   ate));
} catch ( IOException e) {
    // handle/log this error
} catch ( OtherErrorException e) {
    // again handle this
} catch (Exception e) {
    // other errors
}
// optional
}finally {
}
• Chose:
  o Handle errors in subfunctions
  o Throw the error back to higher functions


private Integer convertToInteger(String str) {
try {
   Integer intObj2 = Integer.valueOf(str)
   } catch (e) { // do something }
   return int;
}

private Integer convertToInteger(String str) throws
NumberFormatException {
   Integer intObj2 = Integer.valueOf(str)
}
class CustomException extends Exception {
    public CustomException(String msg){
           super(msg);
       }
}

public class Test {

 public static void main(String[] args) {
  try {
    System.out.println(divide(4,0));
  }
    catch (CustomException e) { e.printStackTrace(); }
  }

static int divide(int first,int second) throws CustomException{
   if(second==0) throw new MyException("dividing by zero");
   return first/second;
  }
}
Error handling in xPages
 • Default errorpage on server (admin can change xspnsfxsp.properties)
 • Set errorpage in application
 • Custom Error page (general, debug, specific)
 • Logging to AgentLog
how wonderful, free stuff
•   JavaScript
•   Java
•   XPages
•   Lotusscript




                  DEMO!!!!!!
◦ Getting it to work is NOT ENOUGH!
◦ Always add errorhandling to production code
◦ Thou shall avoid the use of hard coded stuff
◦ When not sure: check
◦ If it can go wrong, it will go wrong. At one point.
◦ Think first, then build your logic
◦ Do not repeat code
◦ Use only one line of code in events (click,
  query*)
◦ Your users are dumb ...
but: you are even dumber (if you ignore them)
◦ Make your code beautiful: comment not what,
  but why and use meaningfull names
Vince Schuurman             Martin Schaefer
vince.schuurman@gmail.com   martin@mschaefer.nl

Más contenido relacionado

La actualidad más candente

7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handling
Deepak Sharma
 
Unit testing with Easymock
Unit testing with EasymockUnit testing with Easymock
Unit testing with Easymock
Ürgo Ringo
 
Exception Handling
Exception HandlingException Handling
Exception Handling
backdoor
 
Types of exceptions
Types of exceptionsTypes of exceptions
Types of exceptions
myrajendra
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
Richard Paul
 

La actualidad más candente (20)

Mockito intro
Mockito introMockito intro
Mockito intro
 
7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handling
 
Exception handling
Exception handlingException handling
Exception handling
 
Exception handling
Exception handlingException handling
Exception handling
 
Unit testing with Easymock
Unit testing with EasymockUnit testing with Easymock
Unit testing with Easymock
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in java
 
Mockito intro
Mockito introMockito intro
Mockito intro
 
Java exception handling
Java exception handlingJava exception handling
Java exception handling
 
Basic Unit Testing with Mockito
Basic Unit Testing with MockitoBasic Unit Testing with Mockito
Basic Unit Testing with Mockito
 
Presentation on-exception-handling
Presentation on-exception-handlingPresentation on-exception-handling
Presentation on-exception-handling
 
Exception Handling
Exception HandlingException Handling
Exception Handling
 
Types of exceptions
Types of exceptionsTypes of exceptions
Types of exceptions
 
Exception handling in JAVA
Exception handling in JAVAException handling in JAVA
Exception handling in JAVA
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMock
 
Power mock
Power mockPower mock
Power mock
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
 
Exception handling
Exception handlingException handling
Exception handling
 
Exception Handling in Java
Exception Handling in JavaException Handling in Java
Exception Handling in Java
 
Java review: try catch
Java review: try catchJava review: try catch
Java review: try catch
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 

Destacado (9)

Supersize me
Supersize meSupersize me
Supersize me
 
JavaScript and LotusScript - Tricks for Domino Applications
JavaScript and LotusScript - Tricks for Domino ApplicationsJavaScript and LotusScript - Tricks for Domino Applications
JavaScript and LotusScript - Tricks for Domino Applications
 
Oop LotusScript
Oop LotusScriptOop LotusScript
Oop LotusScript
 
Einfach Oop Einfach Handout
Einfach Oop Einfach HandoutEinfach Oop Einfach Handout
Einfach Oop Einfach Handout
 
Lotusphere 2007 AD506 Intermediate LotusScript
Lotusphere 2007 AD506 Intermediate LotusScriptLotusphere 2007 AD506 Intermediate LotusScript
Lotusphere 2007 AD506 Intermediate LotusScript
 
ADLotusphere 2007 AD305 APPLICATION DEVELOPMENT WITH IBM LOTUS DOMINO AND IBM...
ADLotusphere 2007 AD305 APPLICATION DEVELOPMENT WITH IBM LOTUS DOMINO AND IBM...ADLotusphere 2007 AD305 APPLICATION DEVELOPMENT WITH IBM LOTUS DOMINO AND IBM...
ADLotusphere 2007 AD305 APPLICATION DEVELOPMENT WITH IBM LOTUS DOMINO AND IBM...
 
Harness the power of XPages in Lotus Domino
Harness the power of XPages in Lotus DominoHarness the power of XPages in Lotus Domino
Harness the power of XPages in Lotus Domino
 
IBM WebSphere Application Server Introduction for Lotus
IBM WebSphere Application Server Introduction for LotusIBM WebSphere Application Server Introduction for Lotus
IBM WebSphere Application Server Introduction for Lotus
 
I know what you are going to do next summer
I know what you are going to do next summerI know what you are going to do next summer
I know what you are going to do next summer
 

Similar a Error handling in XPages

Exception Handling Exception Handling Exception Handling
Exception Handling Exception Handling Exception HandlingException Handling Exception Handling Exception Handling
Exception Handling Exception Handling Exception Handling
AboMohammad10
 
Software Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW SydneySoftware Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW Sydney
julien.ponge
 

Similar a Error handling in XPages (20)

UNIT III.ppt
UNIT III.pptUNIT III.ppt
UNIT III.ppt
 
UNIT III (2).ppt
UNIT III (2).pptUNIT III (2).ppt
UNIT III (2).ppt
 
Exception Handling In Java Presentation. 2024
Exception Handling In Java Presentation. 2024Exception Handling In Java Presentation. 2024
Exception Handling In Java Presentation. 2024
 
Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024
 
Exception Handling Exception Handling Exception Handling
Exception Handling Exception Handling Exception HandlingException Handling Exception Handling Exception Handling
Exception Handling Exception Handling Exception Handling
 
Unit iii
Unit iiiUnit iii
Unit iii
 
Lecture 09 Exception Handling(1 ) in c++.pptx
Lecture 09 Exception Handling(1 ) in c++.pptxLecture 09 Exception Handling(1 ) in c++.pptx
Lecture 09 Exception Handling(1 ) in c++.pptx
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming
 
Java tut1
Java tut1Java tut1
Java tut1
 
Tutorial java
Tutorial javaTutorial java
Tutorial java
 
Java Tut1
Java Tut1Java Tut1
Java Tut1
 
Java Tutorial
Java TutorialJava Tutorial
Java Tutorial
 
JAVA PROGRAMMING- Exception handling - Multithreading
JAVA PROGRAMMING- Exception handling - MultithreadingJAVA PROGRAMMING- Exception handling - Multithreading
JAVA PROGRAMMING- Exception handling - Multithreading
 
java exception.pptx
java exception.pptxjava exception.pptx
java exception.pptx
 
JDD 2016 - Grzegorz Rozniecki - Java 8 What Could Possibly Go Wrong
JDD 2016 - Grzegorz Rozniecki - Java 8 What Could Possibly Go WrongJDD 2016 - Grzegorz Rozniecki - Java 8 What Could Possibly Go Wrong
JDD 2016 - Grzegorz Rozniecki - Java 8 What Could Possibly Go Wrong
 
Class notes(week 8) on exception handling
Class notes(week 8) on exception handlingClass notes(week 8) on exception handling
Class notes(week 8) on exception handling
 
Hadoop cluster performance profiler
Hadoop cluster performance profilerHadoop cluster performance profiler
Hadoop cluster performance profiler
 
Software Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW SydneySoftware Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW Sydney
 
Java tutorial PPT
Java tutorial PPTJava tutorial PPT
Java tutorial PPT
 
Java tutorial PPT
Java tutorial  PPTJava tutorial  PPT
Java tutorial PPT
 

Más de dominion

What is a itil and how does it relate to your collaborative environment uklug
What is a itil and how does it relate to your collaborative environment   uklugWhat is a itil and how does it relate to your collaborative environment   uklug
What is a itil and how does it relate to your collaborative environment uklug
dominion
 
iOS enterprise
iOS enterpriseiOS enterprise
iOS enterprise
dominion
 
cloud session uklug
cloud session uklugcloud session uklug
cloud session uklug
dominion
 
Uklug 2011 administrator development synergy
Uklug 2011 administrator development synergyUklug 2011 administrator development synergy
Uklug 2011 administrator development synergy
dominion
 
Uklug 2011 client management
Uklug 2011 client managementUklug 2011 client management
Uklug 2011 client management
dominion
 
JavaScript blast
JavaScript blastJavaScript blast
JavaScript blast
dominion
 
Populating your domino directory or any domino database with tivoli directory...
Populating your domino directory or any domino database with tivoli directory...Populating your domino directory or any domino database with tivoli directory...
Populating your domino directory or any domino database with tivoli directory...
dominion
 
Uklug2011 Know your Notes
Uklug2011 Know your NotesUklug2011 Know your Notes
Uklug2011 Know your Notes
dominion
 
Taking themes to the next level
Taking themes to the next levelTaking themes to the next level
Taking themes to the next level
dominion
 
Aussie outback
Aussie outbackAussie outback
Aussie outback
dominion
 
Implementing xpages extension library
Implementing xpages extension libraryImplementing xpages extension library
Implementing xpages extension library
dominion
 
Abb presentation uklug
Abb presentation uklugAbb presentation uklug
Abb presentation uklug
dominion
 
Uklug2011.lotus.on.linux.report.technical.edition.v1.0
Uklug2011.lotus.on.linux.report.technical.edition.v1.0Uklug2011.lotus.on.linux.report.technical.edition.v1.0
Uklug2011.lotus.on.linux.report.technical.edition.v1.0
dominion
 
Domino testing presentation
Domino testing presentationDomino testing presentation
Domino testing presentation
dominion
 
Composite applications tutorial
Composite applications tutorialComposite applications tutorial
Composite applications tutorial
dominion
 
Maximizing application performance
Maximizing application performanceMaximizing application performance
Maximizing application performance
dominion
 
wcm domino
wcm dominowcm domino
wcm domino
dominion
 
leverage dxl
leverage dxlleverage dxl
leverage dxl
dominion
 

Más de dominion (20)

What is a itil and how does it relate to your collaborative environment uklug
What is a itil and how does it relate to your collaborative environment   uklugWhat is a itil and how does it relate to your collaborative environment   uklug
What is a itil and how does it relate to your collaborative environment uklug
 
iOS enterprise
iOS enterpriseiOS enterprise
iOS enterprise
 
cloud session uklug
cloud session uklugcloud session uklug
cloud session uklug
 
Uklug 2011 administrator development synergy
Uklug 2011 administrator development synergyUklug 2011 administrator development synergy
Uklug 2011 administrator development synergy
 
Uklug 2011 client management
Uklug 2011 client managementUklug 2011 client management
Uklug 2011 client management
 
JavaScript blast
JavaScript blastJavaScript blast
JavaScript blast
 
Populating your domino directory or any domino database with tivoli directory...
Populating your domino directory or any domino database with tivoli directory...Populating your domino directory or any domino database with tivoli directory...
Populating your domino directory or any domino database with tivoli directory...
 
Uklug2011 Know your Notes
Uklug2011 Know your NotesUklug2011 Know your Notes
Uklug2011 Know your Notes
 
Quickr
QuickrQuickr
Quickr
 
Taking themes to the next level
Taking themes to the next levelTaking themes to the next level
Taking themes to the next level
 
Aussie outback
Aussie outbackAussie outback
Aussie outback
 
Learning to run
Learning to runLearning to run
Learning to run
 
Implementing xpages extension library
Implementing xpages extension libraryImplementing xpages extension library
Implementing xpages extension library
 
Abb presentation uklug
Abb presentation uklugAbb presentation uklug
Abb presentation uklug
 
Uklug2011.lotus.on.linux.report.technical.edition.v1.0
Uklug2011.lotus.on.linux.report.technical.edition.v1.0Uklug2011.lotus.on.linux.report.technical.edition.v1.0
Uklug2011.lotus.on.linux.report.technical.edition.v1.0
 
Domino testing presentation
Domino testing presentationDomino testing presentation
Domino testing presentation
 
Composite applications tutorial
Composite applications tutorialComposite applications tutorial
Composite applications tutorial
 
Maximizing application performance
Maximizing application performanceMaximizing application performance
Maximizing application performance
 
wcm domino
wcm dominowcm domino
wcm domino
 
leverage dxl
leverage dxlleverage dxl
leverage dxl
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Error handling in XPages

  • 1. errorhandling techniques in XPages, Javascript, Java, Lotusscript and @Formulas
  • 2. What is error handling? Errorhandling in: ◦@Formula ◦Javascript ◦Lotusscript ◦Java ◦xPages Openlog
  • 3. Anticipate, detect and process of programming, user and environment failures or errors Prevent partially by defensive programming What counts is what you do with the errors
  • 4.
  • 5.
  • 6. • Loads of cryptical error messages – no info about triggered events • No central error handling possible - be sparse with your @Formulas - use display fields for re-usable calculations • Defensive programming (@IsError, Test DataTypes: @Elements, @IsTime, @IsNumber, @Text ...)
  • 7.
  • 8. Standard try - catch routine try { // call a function that could error out var result = getInvoiceNumbers(customerNumber,invoiceDate);; } catch (e) { result = "Error in retrieving invoices"; } // optional use finally runs after the try/catch block finally { window.Forms[0].fldname.value = result } Throw your own errors if (number > 10) { throw "NumberTooHighError" }
  • 9. Try - catch routine based on error type try { var result = getInvoiceNumbers(customerNumber,invoiceDate); } catch (e if e == "CustomerNumberException") { result = "Incorrect customerNumber"; } else if e == "DateErrorException") { result = "Incorrect Date"; } else result = "Error in retrieving invoices"; }
  • 10. To register a general errorHandler use: (window.)onerror=functionname() This function will have 3 input variables like: function functionname(msg,url,line_num) You can use these variables to log/show the error details
  • 11.
  • 12. ◦ use On Error blocks ◦ is a big nono .. you are supposed to On Error resume next handle things, not ignoring them ◦ You have differtent audiences: users, developers, administrators. So throw custom errors. ◦ Then handle specific errors ◦ Option Declare prevents some programmatic errors ◦ Create a template in the new 8.5.1 LS IDE for your error new! handling blocks in subs and functions
  • 13.
  • 14. • As with JavaScript use try - catch - finally blocks and throw/catch custom errors Try { List list = new ArrayList(getInvoiceNumbers(customerNumber,invoiceD ate)); } catch ( IOException e) { // handle/log this error } catch ( OtherErrorException e) { // again handle this } catch (Exception e) { // other errors } // optional }finally { }
  • 15. • Chose: o Handle errors in subfunctions o Throw the error back to higher functions private Integer convertToInteger(String str) { try { Integer intObj2 = Integer.valueOf(str) } catch (e) { // do something } return int; } private Integer convertToInteger(String str) throws NumberFormatException { Integer intObj2 = Integer.valueOf(str) }
  • 16. class CustomException extends Exception { public CustomException(String msg){ super(msg); } } public class Test { public static void main(String[] args) { try { System.out.println(divide(4,0)); } catch (CustomException e) { e.printStackTrace(); } } static int divide(int first,int second) throws CustomException{ if(second==0) throw new MyException("dividing by zero"); return first/second; } }
  • 17.
  • 18. Error handling in xPages • Default errorpage on server (admin can change xspnsfxsp.properties) • Set errorpage in application • Custom Error page (general, debug, specific) • Logging to AgentLog
  • 20. JavaScript • Java • XPages • Lotusscript DEMO!!!!!!
  • 21. ◦ Getting it to work is NOT ENOUGH! ◦ Always add errorhandling to production code ◦ Thou shall avoid the use of hard coded stuff ◦ When not sure: check ◦ If it can go wrong, it will go wrong. At one point. ◦ Think first, then build your logic ◦ Do not repeat code ◦ Use only one line of code in events (click, query*) ◦ Your users are dumb ... but: you are even dumber (if you ignore them) ◦ Make your code beautiful: comment not what, but why and use meaningfull names
  • 22. Vince Schuurman Martin Schaefer vince.schuurman@gmail.com martin@mschaefer.nl