1 /*
2 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
13 * reserved.
14 * $COPYRIGHT$
15 *
16 * Additional copyrights may follow
17 *
18 * $HEADER$
19 *
20 *
21 * This file is almost a complete re-write for Open MPI compared to the
22 * original mpiJava package. Its license and copyright are listed below.
23 * See <path to ompi/mpi/java/README> for more information.
24 *
25 *
26 * Licensed under the Apache License, Version 2.0 (the "License");
27 * you may not use this file except in compliance with the License.
28 * You may obtain a copy of the License at
29 *
30 * http://www.apache.org/licenses/LICENSE-2.0
31 *
32 * Unless required by applicable law or agreed to in writing, software
33 * distributed under the License is distributed on an "AS IS" BASIS,
34 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35 * See the License for the specific language governing permissions and
36 * limitations under the License.
37 *
38 *
39 * File : MPIException.java
40 * Author : Bryan Carpenter
41 * Created : Tue Sep 14 13:03:57 EDT 1999
42 * Revision : $Revision: 1.1 $
43 * Updated : $Date: 1999/09/14 22:01:52 $
44 * Copyright: Northeast Parallel Architectures Center
45 * at Syracuse University 1999
46 */
47
48 package mpi;
49
50 /**
51 * Signals that an MPI exception of some sort has occurred.
52 * <p>The Java binding of the MPI operation {@code MPI_Error_string} is the
53 * method {@code getMessage}, which is inherited from the class Exception.
54 */
55 public final class MPIException extends Exception
56 {
57 private int errorCode, errorClass;
58
59 protected MPIException(int code, int clazz, String message)
60 {
61 super(message);
62 errorCode = code;
63 errorClass = clazz;
64 }
65
66 /**
67 * Creates an exception.
68 * @param message message associated to the exception
69 */
70 public MPIException(String message)
71 {
72 super(message);
73 }
74
75 /**
76 * Creates an exception:
77 * @param cause cause associated to the exception
78 */
79 public MPIException(Throwable cause)
80 {
81 super(cause);
82 setStackTrace(cause.getStackTrace());
83 }
84
85 /**
86 * Gets the MPI error code.
87 * @return error code
88 */
89 public int getErrorCode()
90 {
91 return errorCode;
92 }
93
94 /**
95 * Gets the MPI error class.
96 * @return error class
97 */
98 public int getErrorClass()
99 {
100 return errorClass;
101 }
102
103 } // MPIException