SlideShare a Scribd company logo
1 of 22
Download to read offline
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

More Related Content

What's hot

7.error management and exception handling
7.error management and exception handling7.error management and exception handling
7.error management and exception handlingDeepak Sharma
 
Exception handling
Exception handlingException handling
Exception handlingAnna Pietras
 
Exception handling
Exception handlingException handling
Exception handlingRaja Sekhar
 
Unit testing with Easymock
Unit testing with EasymockUnit testing with Easymock
Unit testing with EasymockÜrgo Ringo
 
Exception handling in java
Exception handling in javaException handling in java
Exception handling in javapooja kumari
 
Basic Unit Testing with Mockito
Basic Unit Testing with MockitoBasic Unit Testing with Mockito
Basic Unit Testing with MockitoAlexander De Leon
 
Presentation on-exception-handling
Presentation on-exception-handlingPresentation on-exception-handling
Presentation on-exception-handlingNahian Ahmed
 
Exception Handling
Exception HandlingException Handling
Exception Handlingbackdoor
 
Types of exceptions
Types of exceptionsTypes of exceptions
Types of exceptionsmyrajendra
 
Exception handling in JAVA
Exception handling in JAVAException handling in JAVA
Exception handling in JAVAKunal Singh
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMockYing Zhang
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with MockitoRichard Paul
 

What's hot (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
 

Viewers also liked

Supersize me
Supersize meSupersize me
Supersize medominion
 
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 Applicationsdominion
 
Oop LotusScript
Oop LotusScriptOop LotusScript
Oop LotusScriptdominion
 
Einfach Oop Einfach Handout
Einfach Oop Einfach HandoutEinfach Oop Einfach Handout
Einfach Oop Einfach Handoutdominion
 
Lotusphere 2007 AD506 Intermediate LotusScript
Lotusphere 2007 AD506 Intermediate LotusScriptLotusphere 2007 AD506 Intermediate LotusScript
Lotusphere 2007 AD506 Intermediate LotusScriptdominion
 
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...dominion
 
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 Dominodominion
 
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 Lotusdominion
 
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 summerdominion
 

Viewers also liked (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 to Error handling in XPages

UNIT III.ppt
UNIT III.pptUNIT III.ppt
UNIT III.pptAjit Mali
 
Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024nehakumari0xf
 
Exception Handling In Java Presentation. 2024
Exception Handling In Java Presentation. 2024Exception Handling In Java Presentation. 2024
Exception Handling In Java Presentation. 2024kashyapneha2809
 
Exception Handling Exception Handling Exception Handling
Exception Handling Exception Handling Exception HandlingException Handling Exception Handling Exception Handling
Exception Handling Exception Handling Exception HandlingAboMohammad10
 
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming  Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 2 - TypeScript Programming WebStackAcademy
 
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 WrongPROIDEA
 
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 handlingKuntal Bhowmick
 
Hadoop cluster performance profiler
Hadoop cluster performance profilerHadoop cluster performance profiler
Hadoop cluster performance profilerIhor Bobak
 
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 Sydneyjulien.ponge
 

Similar to 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
 
Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024Java-Exception Handling Presentation. 2024
Java-Exception Handling Presentation. 2024
 
Exception Handling In Java Presentation. 2024
Exception Handling In Java Presentation. 2024Exception Handling In Java Presentation. 2024
Exception Handling In Java 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
 
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
 
Exception handling
Exception handlingException handling
Exception handling
 

More from 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 uklugdominion
 
iOS enterprise
iOS enterpriseiOS enterprise
iOS enterprisedominion
 
cloud session uklug
cloud session uklugcloud session uklug
cloud session uklugdominion
 
Uklug 2011 administrator development synergy
Uklug 2011 administrator development synergyUklug 2011 administrator development synergy
Uklug 2011 administrator development synergydominion
 
Uklug 2011 client management
Uklug 2011 client managementUklug 2011 client management
Uklug 2011 client managementdominion
 
JavaScript blast
JavaScript blastJavaScript blast
JavaScript blastdominion
 
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 Notesdominion
 
Taking themes to the next level
Taking themes to the next levelTaking themes to the next level
Taking themes to the next leveldominion
 
Aussie outback
Aussie outbackAussie outback
Aussie outbackdominion
 
Learning to run
Learning to runLearning to run
Learning to rundominion
 
Implementing xpages extension library
Implementing xpages extension libraryImplementing xpages extension library
Implementing xpages extension librarydominion
 
Abb presentation uklug
Abb presentation uklugAbb presentation uklug
Abb presentation uklugdominion
 
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.0dominion
 
Domino testing presentation
Domino testing presentationDomino testing presentation
Domino testing presentationdominion
 
Composite applications tutorial
Composite applications tutorialComposite applications tutorial
Composite applications tutorialdominion
 
Maximizing application performance
Maximizing application performanceMaximizing application performance
Maximizing application performancedominion
 
wcm domino
wcm dominowcm domino
wcm dominodominion
 
leverage dxl
leverage dxlleverage dxl
leverage dxldominion
 

More from 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
 

Recently uploaded

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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 productivityPrincipled Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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 Scriptwesley chun
 
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 StreamsRoshan Dwivedi
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

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