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 032 * should catch ServiceRuntimeException and ServiceException.</li> 033 * <li>Applications with specific error handling logic (eg: ignoring/coping with a failed remote task) should catch 034 * the subclass of ServiceRuntimeException / ServiceException thrown by the library they are using.</li> 035 * </ul> 036 * 037 * @see ServiceRuntimeException 038 */ 039public class ServiceException extends Exception { 040 private static final long serialVersionUID = 1L; 041 042 public ServiceException(final String s, final Throwable e) { 043 super(s, e); 044 } 045 046 public ServiceException(final String s) { 047 super(s); 048 } 049 050 public ServiceException(final Throwable e) { 051 super(e); 052 } 053 054}