public abstract class SException
extends java.lang.RuntimeException
Subclasses are actually thrown, namely SException.Error
to
indicate probable bugs in the user's program,
SException.InternalError
to indicate bugs in SimpleOrm,
SException.Jdbc
for chained JDBC errors,
SException.Data
for errors that probably the result of
run-time data problems. SException.Test
is used to indicate
failed test cases.
Other well defined exceptions that a user may want to trap are given explicit
subclasses (eg. SRecordInstance.BrokenOptimisticLockException
).
SimpleORM only throws SExceptions which extend RuntimeException and so avoid the need to clutter the code with unnecessary try/catch blocks. The only reason to use try/catch when using SimpleORM is because you really want to catch an error.
(The author stongly disagrees with the way that Java forces one to declare
and catch exceptions because it encourages mediocre programmers to hide
exceptions which is a very nasty practice. (Even Sun programmers do this
quite regularly in the Java libraries, eg. System.out.println()
!)
It also clutters the code for no good reason. IMHO Java's "checked"
exceptions add no value whatsoever in practice.)
Modifier and Type | Class and Description |
---|---|
static class |
SException.Data
Errors in data or environment at runtime, not necessarily a programming
bug.
|
static class |
SException.Error
Probable bug in user's program.
|
static class |
SException.InternalError
Probable bug in SimpleORM.
|
static class |
SException.Jdbc
Chained JDBC Exception, could be anything as JDBC does not separate
exceptions out and provides minimal information about their underlying
causes.
|
static class |
SException.Test
Exception thrown due to failed unit test cases.
|
static class |
SException.Validation
This Exception thrown by user written code to indicate user data entry
errors, especially in the business rule methods.
|
Constructor and Description |
---|
SException()
Avoid using this one, include message.
|
SException(java.lang.String message) |
SException(java.lang.String message,
java.lang.Throwable nestedException) |
SException(java.lang.Throwable nestedException) |
Modifier and Type | Method and Description |
---|---|
SFieldMeta |
getFieldMeta() |
java.lang.Object |
getFieldValue() |
SRecordInstance |
getInstance() |
java.lang.Object[] |
getParams() |
SRecordInstance |
getRecordInstance() |
java.lang.Class<SValidatorI> |
getValidator() |
SException |
setFieldMeta(SFieldMeta fieldMeta) |
SException |
setFieldValue(java.lang.Object fieldValue) |
SException |
setInstance(SRecordInstance instance) |
SException |
setParams(java.lang.Object... params) |
SException |
setRecordInstance(SRecordInstance instance) |
SException |
setValidator(java.lang.Class<SValidatorI> validator) |
public SException(java.lang.String message, java.lang.Throwable nestedException)
public SException(java.lang.String message)
public SException(java.lang.Throwable nestedException)
public SException()
public SRecordInstance getRecordInstance()
public SException setRecordInstance(SRecordInstance instance)
public SFieldMeta getFieldMeta()
public SException setFieldMeta(SFieldMeta fieldMeta)
public SRecordInstance getInstance()
public SException setInstance(SRecordInstance instance)
public java.lang.Object getFieldValue()
public SException setFieldValue(java.lang.Object fieldValue)
public java.lang.Object[] getParams()
public SException setParams(java.lang.Object... params)
public java.lang.Class<SValidatorI> getValidator()
public SException setValidator(java.lang.Class<SValidatorI> validator)