001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.exception.evaluator; 020 021/** 022 * The base class for exceptions thrown by REEF libraries and services. 023 * <p/> 024 * Rules of thumb for exception handling in REEF: 025 * <ul> 026 * <li>When possible, throw a subclass of ServiceException, with the following exceptions (no pun intended)</li> 027 * <li>Iterator and other standard Java interfaces neglect to declare throws 028 * clauses. Use ServiceRuntimeException when implementing such interfaces.</li> 029 * <li>If there is no good way for Task code to recover from the exception, throw 030 * (and document) a subclass of ServiceRuntimeException</li> 031 * <li>Applications with generic, catch-all error handling should catch ServiceRuntimeException and ServiceException.</li> 032 * <li>Applications with specific error handling logic (eg: ignoring/coping with a failed remote task) should catch 033 * the subclass of ServiceRuntimeException / ServiceException thrown by the library they are using.</li> 034 * </ul> 035 * 036 * @see ServiceRuntimeException 037 */ 038public class ServiceException extends Exception { 039 private static final long serialVersionUID = 1L; 040 041 public ServiceException(final String s, final Throwable e) { 042 super(s, e); 043 } 044 045 public ServiceException(final String s) { 046 super(s); 047 } 048 049 public ServiceException(final Throwable e) { 050 super(e); 051 } 052 053}