001/* 002 * ============================================================================ 003 * Copyright © 2002-2020 by Thomas Thrien. 004 * All Rights Reserved. 005 * ============================================================================ 006 * Licensed to the public under the agreements of the GNU Lesser General Public 007 * License, version 3.0 (the "License"). You may obtain a copy of the License at 008 * 009 * http://www.gnu.org/licenses/lgpl.html 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 014 * License for the specific language governing permissions and limitations 015 * under the License. 016 */ 017 018package org.tquadrat.foundation.lang; 019 020import static org.apiguardian.api.API.Status.STABLE; 021 022import org.apiguardian.api.API; 023import org.tquadrat.foundation.annotation.ClassVersion; 024 025/** 026 * This is a 027 * {@link FunctionalInterface} 028 * meant to process a given error code and to throw an exception based on 029 * that, or to cause some side effects. 030 * 031 * @param <C> The type of the error code. 032 * 033 * @extauthor Thomas Thrien-thomas.thrien@tquadrat.org 034 * @version $Id: ErrorHandler.java 1025 2022-03-11 16:26:00Z tquadrat $ 035 * @since 0.1.0 036 * 037 * @see Status 038 * 039 * @UMLGraph.link 040 */ 041@ClassVersion( sourceVersion = "$Id: ErrorHandler.java 1025 2022-03-11 16:26:00Z tquadrat $" ) 042@API( status = STABLE, since = "0.1.0" ) 043@FunctionalInterface 044public interface ErrorHandler<C> 045{ 046 /*---------*\ 047 ====** Methods **========================================================== 048 \*---------*/ 049 /** 050 * Handle the given error and act accordingly. 051 * 052 * @param errorCode The error code. 053 * @return The exception that was determined based on the given error 054 * code. 055 */ 056 public RuntimeException handleError( final C errorCode ); 057} 058// interface ErrorHandler 059 060/* 061 * End of File 062 */