Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleJava Error Handling
//For catching exceptions
import alma.<Interface>Err.<ExceptionName>Ex;
catch (<ExceptionName>Ex e) {

//For raising exceptions
import alma.<Interface>Err.wrappers.AcsJ<ExceptionName>Ex;
throw new AcsJ<ExceptionName>Ex("<CustomMessage>").to<ExceptionName>Ex();

//For raising exceptions with parameters
import alma.<Interface>Err.wrappers.AcsJ<ExceptionName>Ex;
AcsJ<ExceptionName>Ex err = new AcsJ<ExceptionName>Ex("<CustomMessage>");
err.set<ParamName>(<Value>);
raisethrow err.to<ExceptionName>Ex();

//For logging an error message from the exceptions
import alma.<Interface>Err.wrappers.AcsJ<ExceptionName>Ex;
AcsJ<ExceptionName>Ex err = <Interface>ErrImpl.<ExceptionName>ExImpl()
err.log(m_logger);
raisethrow err.to<ExceptionName>Ex();

...