Versions Compared

Key

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

...

OSIDs strictly define the permissible checked an unchecked exceptions which may pass. They are straightforward in the most basic of method implementations. However, some semantic analysis is necessary when creating a chain of methods to help convey what may have gone wrong to your consumer or ultimately your end user.

Basic Examples

The Decorator

...

In a decorator pattern (same holds true for adapter patterns across instantiated OSID Providers), the same method is used in both layers. The method signatures line up and more importantly the semantics of the method are identical so the exceptions can just bubble through.

...

However, there may be a reason to catch an exception or two.

Jumping In The Way

The previous example logged retrievals even when it didn’t work. This example more accurately distinguishes successes from failures.

...

In most cases, there is no reason to catch org.osid.OsidRuntimeException of any of its subclasses.

Method Factoring

Passing The Buck

See Also

...